mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 01:36:24 +01:00
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:
parent
57b7a668c0
commit
d0779e2ec2
3 changed files with 30 additions and 0 deletions
|
@ -60,4 +60,8 @@ var defaultSetDesc = setDesc{
|
||||||
lnwire.AMPRequired: {
|
lnwire.AMPRequired: {
|
||||||
SetInvoiceAmp: {}, // 9A
|
SetInvoiceAmp: {}, // 9A
|
||||||
},
|
},
|
||||||
|
lnwire.ExplicitChannelTypeOptional: {
|
||||||
|
SetInit: {}, // I
|
||||||
|
SetNodeAnn: {}, // N
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,9 +58,13 @@ var deps = depDesc{
|
||||||
lnwire.AnchorsOptional: {
|
lnwire.AnchorsOptional: {
|
||||||
lnwire.StaticRemoteKeyOptional: {},
|
lnwire.StaticRemoteKeyOptional: {},
|
||||||
},
|
},
|
||||||
|
lnwire.AnchorsZeroFeeHtlcTxOptional: {
|
||||||
|
lnwire.StaticRemoteKeyOptional: {},
|
||||||
|
},
|
||||||
lnwire.AMPOptional: {
|
lnwire.AMPOptional: {
|
||||||
lnwire.PaymentAddrOptional: {},
|
lnwire.PaymentAddrOptional: {},
|
||||||
},
|
},
|
||||||
|
lnwire.ExplicitChannelTypeOptional: {},
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateDeps asserts that a feature vector sets all features and their
|
// ValidateDeps asserts that a feature vector sets all features and their
|
||||||
|
|
|
@ -139,6 +139,26 @@ const (
|
||||||
// sender-generated preimages according to BOLT XX.
|
// sender-generated preimages according to BOLT XX.
|
||||||
AMPOptional FeatureBit = 31
|
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.
|
// maxAllowedSize is a maximum allowed size of feature vector.
|
||||||
//
|
//
|
||||||
// NOTE: Within the protocol, the maximum allowed message size is 65535
|
// NOTE: Within the protocol, the maximum allowed message size is 65535
|
||||||
|
@ -184,6 +204,8 @@ var Features = map[FeatureBit]string{
|
||||||
WumboChannelsOptional: "wumbo-channels",
|
WumboChannelsOptional: "wumbo-channels",
|
||||||
AMPRequired: "amp",
|
AMPRequired: "amp",
|
||||||
AMPOptional: "amp",
|
AMPOptional: "amp",
|
||||||
|
ExplicitChannelTypeOptional: "explicit-commitment-type",
|
||||||
|
ExplicitChannelTypeRequired: "explicit-commitment-type",
|
||||||
}
|
}
|
||||||
|
|
||||||
// RawFeatureVector represents a set of feature bits as defined in BOLT-09. A
|
// RawFeatureVector represents a set of feature bits as defined in BOLT-09. A
|
||||||
|
|
Loading…
Add table
Reference in a new issue