funding: update explicitNegotiateCommitmentType to recognize taproot chans

This commit is contained in:
Olaoluwa Osuntokun committed 2023-08-22 16:32:05 -07:00
1 parent 32f4f4cea7
commit a8416300dd
1 file changed
+46
+46
View File
@@ -240,6 +240,52 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local,
}
return lnwallet.CommitmentTypeTweakless, nil
// Simple taproot channels only.
case channelFeatures.OnlyContains(lnwire.SimpleTaprootChannelsRequired):
if !hasFeatures(
local, remote, lnwire.SimpleTaprootChannelsOptional,
) {
return 0, errUnsupportedChannelType
}
return lnwallet.CommitmentTypeSimpleTaproot, nil
// Simple taproot channels with scid only.
case channelFeatures.OnlyContains(
lnwire.SimpleTaprootChannelsRequired,
lnwire.ScidAliasRequired,
):
if !hasFeatures(
local, remote,
lnwire.SimpleTaprootChannelsOptional,
lnwire.ScidAliasOptional,
) {
return 0, errUnsupportedChannelType
}
return lnwallet.CommitmentTypeSimpleTaproot, nil
// Simple taproot channels with zero conf only.
case channelFeatures.OnlyContains(
lnwire.SimpleTaprootChannelsRequired,
lnwire.ZeroConfRequired,
):
if !hasFeatures(
local, remote,
lnwire.SimpleTaprootChannelsOptional,
lnwire.ZeroConfOptional,
) {
return 0, errUnsupportedChannelType
}
return lnwallet.CommitmentTypeSimpleTaproot, nil
// No features, use legacy commitment type.
case channelFeatures.IsEmpty():
return lnwallet.CommitmentTypeLegacy, nil