mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-24 18:39:10 +02:00
funding: add chan type awareness for new taproot chans overlay
This commit is contained in:
committed by
Oliver Gugger
parent
4efa39ddb1
commit
72d437d5c8
@@ -307,6 +307,74 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local,
|
|||||||
|
|
||||||
return lnwallet.CommitmentTypeSimpleTaproot, nil
|
return lnwallet.CommitmentTypeSimpleTaproot, nil
|
||||||
|
|
||||||
|
// Simple taproot channels overlay only.
|
||||||
|
case channelFeatures.OnlyContains(
|
||||||
|
lnwire.SimpleTaprootOverlayChansRequired,
|
||||||
|
):
|
||||||
|
|
||||||
|
if !hasFeatures(
|
||||||
|
local, remote,
|
||||||
|
lnwire.SimpleTaprootOverlayChansOptional,
|
||||||
|
) {
|
||||||
|
|
||||||
|
return 0, errUnsupportedChannelType
|
||||||
|
}
|
||||||
|
|
||||||
|
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
|
||||||
|
|
||||||
|
// Simple taproot overlay channels with scid only.
|
||||||
|
case channelFeatures.OnlyContains(
|
||||||
|
lnwire.SimpleTaprootOverlayChansRequired,
|
||||||
|
lnwire.ScidAliasRequired,
|
||||||
|
):
|
||||||
|
|
||||||
|
if !hasFeatures(
|
||||||
|
local, remote,
|
||||||
|
lnwire.SimpleTaprootOverlayChansOptional,
|
||||||
|
lnwire.ScidAliasOptional,
|
||||||
|
) {
|
||||||
|
|
||||||
|
return 0, errUnsupportedChannelType
|
||||||
|
}
|
||||||
|
|
||||||
|
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
|
||||||
|
|
||||||
|
// Simple taproot overlay channels with zero conf only.
|
||||||
|
case channelFeatures.OnlyContains(
|
||||||
|
lnwire.SimpleTaprootOverlayChansRequired,
|
||||||
|
lnwire.ZeroConfRequired,
|
||||||
|
):
|
||||||
|
|
||||||
|
if !hasFeatures(
|
||||||
|
local, remote,
|
||||||
|
lnwire.SimpleTaprootOverlayChansOptional,
|
||||||
|
lnwire.ZeroConfOptional,
|
||||||
|
) {
|
||||||
|
|
||||||
|
return 0, errUnsupportedChannelType
|
||||||
|
}
|
||||||
|
|
||||||
|
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
|
||||||
|
|
||||||
|
// Simple taproot overlay channels with scid and zero conf.
|
||||||
|
case channelFeatures.OnlyContains(
|
||||||
|
lnwire.SimpleTaprootOverlayChansRequired,
|
||||||
|
lnwire.ZeroConfRequired,
|
||||||
|
lnwire.ScidAliasRequired,
|
||||||
|
):
|
||||||
|
|
||||||
|
if !hasFeatures(
|
||||||
|
local, remote,
|
||||||
|
lnwire.SimpleTaprootOverlayChansOptional,
|
||||||
|
lnwire.ZeroConfOptional,
|
||||||
|
lnwire.ScidAliasOptional,
|
||||||
|
) {
|
||||||
|
|
||||||
|
return 0, errUnsupportedChannelType
|
||||||
|
}
|
||||||
|
|
||||||
|
return lnwallet.CommitmentTypeSimpleTaprootOverlay, nil
|
||||||
|
|
||||||
// No features, use legacy commitment type.
|
// No features, use legacy commitment type.
|
||||||
case channelFeatures.IsEmpty():
|
case channelFeatures.IsEmpty():
|
||||||
return lnwallet.CommitmentTypeLegacy, nil
|
return lnwallet.CommitmentTypeLegacy, nil
|
||||||
|
Reference in New Issue
Block a user