lnwire: add new feature bits for explicit channel type negotiation

If these bits are present, then both sides can examine the new
CommitmentType TLV field that's present and use this in place of the
existing implicit commiment type negotiation. With this change, it's now
possible to actually deprecate old unsupported commitment types
properly.
This commit is contained in:
Olaoluwa Osuntokun 2021-03-03 19:39:12 -08:00
parent 57b7a668c0
commit d0779e2ec2
No known key found for this signature in database
GPG key ID: 3BBD59E99B280306
3 changed files with 30 additions and 0 deletions

View file

@ -60,4 +60,8 @@ var defaultSetDesc = setDesc{
lnwire.AMPRequired: {
SetInvoiceAmp: {}, // 9A
},
lnwire.ExplicitChannelTypeOptional: {
SetInit: {}, // I
SetNodeAnn: {}, // N
},
}

View file

@ -58,9 +58,13 @@ var deps = depDesc{
lnwire.AnchorsOptional: {
lnwire.StaticRemoteKeyOptional: {},
},
lnwire.AnchorsZeroFeeHtlcTxOptional: {
lnwire.StaticRemoteKeyOptional: {},
},
lnwire.AMPOptional: {
lnwire.PaymentAddrOptional: {},
},
lnwire.ExplicitChannelTypeOptional: {},
}
// ValidateDeps asserts that a feature vector sets all features and their

View file

@ -139,6 +139,26 @@ const (
// sender-generated preimages according to BOLT XX.
AMPOptional FeatureBit = 31
// ExplicitChannelTypeRequired is a required bit that denotes that a
// connection established with this node is to use explicit channel
// commitment types for negotiation instead of the existing implicit
// negotiation methods. With this bit, there is no longer a "default"
// implicit channel commitment type, allowing a connection to
// open/maintain types of several channels over its lifetime.
//
// TODO: Decide on actual feature bit value.
ExplicitChannelTypeRequired = 2020
// ExplicitChannelTypeOptional is an optional bit that denotes that a
// connection established with this node is to use explicit channel
// commitment types for negotiation instead of the existing implicit
// negotiation methods. With this bit, there is no longer a "default"
// implicit channel commitment type, allowing a connection to
// open/maintain types of several channels over its lifetime.
//
// TODO: Decide on actual feature bit value.
ExplicitChannelTypeOptional = 2021
// maxAllowedSize is a maximum allowed size of feature vector.
//
// NOTE: Within the protocol, the maximum allowed message size is 65535
@ -184,6 +204,8 @@ var Features = map[FeatureBit]string{
WumboChannelsOptional: "wumbo-channels",
AMPRequired: "amp",
AMPOptional: "amp",
ExplicitChannelTypeOptional: "explicit-commitment-type",
ExplicitChannelTypeRequired: "explicit-commitment-type",
}
// RawFeatureVector represents a set of feature bits as defined in BOLT-09. A