feature: use +100 staging bit for taproot channels
In this commit, we carry out a new notion introduced during a recent spec meeting to use a feature bit plus 100 before the feature has been finalized in the spec. We split into the Final and Staging bits.
This commit is contained in:
9 files changed
+92
-76
No files matched your search
@@ -241,10 +241,13 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local,
|
||||
return lnwallet.CommitmentTypeTweakless, nil
|
||||
|
||||
// Simple taproot channels only.
|
||||
case channelFeatures.OnlyContains(lnwire.SimpleTaprootChannelsRequired):
|
||||
case channelFeatures.OnlyContains(
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
):
|
||||
|
||||
if !hasFeatures(
|
||||
local, remote, lnwire.SimpleTaprootChannelsOptional,
|
||||
local, remote,
|
||||
lnwire.SimpleTaprootChannelsOptionalStaging,
|
||||
) {
|
||||
|
||||
return 0, errUnsupportedChannelType
|
||||
@@ -254,13 +257,13 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local,
|
||||
|
||||
// Simple taproot channels with scid only.
|
||||
case channelFeatures.OnlyContains(
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
lnwire.ScidAliasRequired,
|
||||
):
|
||||
|
||||
if !hasFeatures(
|
||||
local, remote,
|
||||
lnwire.SimpleTaprootChannelsOptional,
|
||||
lnwire.SimpleTaprootChannelsOptionalStaging,
|
||||
lnwire.ScidAliasOptional,
|
||||
) {
|
||||
|
||||
@@ -271,13 +274,13 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local,
|
||||
|
||||
// Simple taproot channels with zero conf only.
|
||||
case channelFeatures.OnlyContains(
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
lnwire.ZeroConfRequired,
|
||||
):
|
||||
|
||||
if !hasFeatures(
|
||||
local, remote,
|
||||
lnwire.SimpleTaprootChannelsOptional,
|
||||
lnwire.SimpleTaprootChannelsOptionalStaging,
|
||||
lnwire.ZeroConfOptional,
|
||||
) {
|
||||
|
||||
@@ -288,14 +291,14 @@ func explicitNegotiateCommitmentType(channelType lnwire.ChannelType, local,
|
||||
|
||||
// Simple taproot channels with scid and zero conf.
|
||||
case channelFeatures.OnlyContains(
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
lnwire.ZeroConfRequired,
|
||||
lnwire.ScidAliasRequired,
|
||||
):
|
||||
|
||||
if !hasFeatures(
|
||||
local, remote,
|
||||
lnwire.SimpleTaprootChannelsOptional,
|
||||
lnwire.SimpleTaprootChannelsOptionalStaging,
|
||||
lnwire.ZeroConfOptional,
|
||||
) {
|
||||
|
||||
@@ -320,16 +323,6 @@ func implicitNegotiateCommitmentType(local,
|
||||
remote *lnwire.FeatureVector) (*lnwire.ChannelType,
|
||||
lnwallet.CommitmentType) {
|
||||
|
||||
// If both peers are signalling support for taproot chanenls, then
|
||||
// we'll use that type.
|
||||
if hasFeatures(local, remote, lnwire.SimpleTaprootChannelsOptional) {
|
||||
chanType := lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
))
|
||||
|
||||
return &chanType, lnwallet.CommitmentTypeSimpleTaproot
|
||||
}
|
||||
|
||||
// If both peers are signalling support for anchor commitments with
|
||||
// zero-fee HTLC transactions, we'll use this type.
|
||||
if hasFeatures(local, remote, lnwire.AnchorsZeroFeeHtlcTxOptional) {
|
||||
|
||||
+3
-1
@@ -4077,7 +4077,9 @@ func (f *Manager) newChanAnnouncement(localPubKey,
|
||||
log.Debugf("Applying taproot feature bit to "+
|
||||
"ChannelAnnouncement for %v", chanID)
|
||||
|
||||
chanAnn.Features.Set(lnwire.SimpleTaprootChannelsRequired)
|
||||
chanAnn.Features.Set(
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
)
|
||||
}
|
||||
|
||||
// The chanFlags field indicates which directed edge of the channel is
|
||||
|
||||
@@ -742,7 +742,7 @@ func isTaprootChanType(chanType *lnwire.ChannelType) bool {
|
||||
featVec := lnwire.RawFeatureVector(*chanType)
|
||||
|
||||
return featVec.IsSet(
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1423,7 +1423,7 @@ func testNormalWorkflow(t *testing.T, chanType *lnwire.ChannelType) {
|
||||
lnwire.ExplicitChannelTypeOptional,
|
||||
lnwire.StaticRemoteKeyOptional,
|
||||
lnwire.AnchorsZeroFeeHtlcTxOptional,
|
||||
lnwire.SimpleTaprootChannelsOptional,
|
||||
lnwire.SimpleTaprootChannelsOptionalStaging,
|
||||
}
|
||||
alice.localFeatures = featureBits
|
||||
alice.remoteFeatures = featureBits
|
||||
@@ -1543,7 +1543,7 @@ func TestFundingManagerNormalWorkflow(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
taprootChanType := lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
))
|
||||
|
||||
testCases := []struct {
|
||||
@@ -4460,7 +4460,7 @@ func testZeroConf(t *testing.T, chanType *lnwire.ChannelType) {
|
||||
lnwire.ExplicitChannelTypeOptional,
|
||||
lnwire.StaticRemoteKeyOptional,
|
||||
lnwire.AnchorsZeroFeeHtlcTxOptional,
|
||||
lnwire.SimpleTaprootChannelsOptional,
|
||||
lnwire.SimpleTaprootChannelsOptionalStaging,
|
||||
}
|
||||
alice.localFeatures = featureBits
|
||||
alice.remoteFeatures = featureBits
|
||||
@@ -4476,7 +4476,7 @@ func testZeroConf(t *testing.T, chanType *lnwire.ChannelType) {
|
||||
if isTaprootChanType(chanType) {
|
||||
channelTypeBits = []lnwire.FeatureBit{
|
||||
lnwire.ZeroConfRequired,
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
}
|
||||
} else {
|
||||
channelTypeBits = []lnwire.FeatureBit{
|
||||
@@ -4708,7 +4708,7 @@ func TestFundingManagerZeroConf(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
taprootChanType := lnwire.ChannelType(*lnwire.NewRawFeatureVector(
|
||||
lnwire.SimpleTaprootChannelsRequired,
|
||||
lnwire.SimpleTaprootChannelsRequiredStaging,
|
||||
))
|
||||
|
||||
testCases := []struct {
|
||||
|
||||
Reference in new issue
Block a user