diff --git a/feature/default_sets.go b/feature/default_sets.go index ae8187efb..7956f6932 100644 --- a/feature/default_sets.go +++ b/feature/default_sets.go @@ -71,4 +71,12 @@ var defaultSetDesc = setDesc{ SetInit: {}, // I SetNodeAnn: {}, // N }, + lnwire.ScidAliasOptional: { + SetInit: {}, // I + SetNodeAnn: {}, // N + }, + lnwire.ZeroConfOptional: { + SetInit: {}, // I + SetNodeAnn: {}, // N + }, } diff --git a/feature/deps.go b/feature/deps.go index 36a1bde74..542732eba 100644 --- a/feature/deps.go +++ b/feature/deps.go @@ -72,6 +72,12 @@ var deps = depDesc{ lnwire.KeysendOptional: { lnwire.TLVOnionPayloadOptional: {}, }, + lnwire.ScidAliasOptional: { + lnwire.ExplicitChannelTypeOptional: {}, + }, + lnwire.ZeroConfOptional: { + lnwire.ScidAliasOptional: {}, + }, } // ValidateDeps asserts that a feature vector sets all features and their diff --git a/feature/manager.go b/feature/manager.go index 5048da332..6d7787950 100644 --- a/feature/manager.go +++ b/feature/manager.go @@ -31,6 +31,15 @@ type Config struct { // NoKeysend unsets any bits signaling support for accepting keysend // payments. NoKeysend bool + + // NoOptionScidAlias unsets any bits signalling support for + // option_scid_alias. This also implicitly disables zero-conf channels. + NoOptionScidAlias bool + + // NoZeroConf unsets any bits signalling support for zero-conf + // channels. This should be used instead of NoOptionScidAlias to still + // keep option-scid-alias support. + NoZeroConf bool } // Manager is responsible for generating feature vectors for different requested @@ -125,6 +134,14 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) { raw.Unset(lnwire.KeysendOptional) raw.Unset(lnwire.KeysendRequired) } + if cfg.NoOptionScidAlias { + raw.Unset(lnwire.ScidAliasOptional) + raw.Unset(lnwire.ScidAliasRequired) + } + if cfg.NoZeroConf { + raw.Unset(lnwire.ZeroConfOptional) + raw.Unset(lnwire.ZeroConfRequired) + } // Ensure that all of our feature sets properly set any // dependent features. diff --git a/lnwire/features.go b/lnwire/features.go index b62202ba5..55ee5bd10 100644 --- a/lnwire/features.go +++ b/lnwire/features.go @@ -155,6 +155,16 @@ const ( // TODO: Decide on actual feature bit value. ExplicitChannelTypeOptional = 45 + // ScidAliasRequired is a required feature bit that signals that the + // node requires understanding of ShortChannelID aliases in the TLV + // segment of the funding_locked message. + ScidAliasRequired FeatureBit = 46 + + // ScidAliasOptional is an optional feature bit that signals that the + // node understands ShortChannelID aliases in the TLV segment of the + // funding_locked message. + ScidAliasOptional FeatureBit = 47 + // PaymentMetadataRequired is a required bit that denotes that if an // invoice contains metadata, it must be passed along with the payment // htlc(s). @@ -165,6 +175,14 @@ const ( // htlc(s). PaymentMetadataOptional = 49 + // ZeroConfRequired is a required feature bit that signals that the + // node requires understanding of the zero-conf channel_type. + ZeroConfRequired FeatureBit = 50 + + // ZeroConfOptional is an optional feature bit that signals that the + // node understands the zero-conf channel type. + ZeroConfOptional FeatureBit = 51 + // KeysendRequired is a required bit that indicates that the node is // able and willing to accept keysend payments. KeysendRequired = 54 @@ -173,7 +191,7 @@ const ( // able and willing to accept keysend payments. KeysendOptional = 55 - // ScriptEnforcedLeaseRequired is a required feature bit that signals + // ScriptEnforcedLeaseOptional is an optional feature bit that signals // that the node requires channels having zero-fee second-level HTLC // transactions, which also imply anchor commitments, along with an // additional CLTV constraint of a channel lease's expiration height @@ -244,6 +262,10 @@ var Features = map[FeatureBit]string{ KeysendRequired: "keysend", ScriptEnforcedLeaseRequired: "script-enforced-lease", ScriptEnforcedLeaseOptional: "script-enforced-lease", + ScidAliasRequired: "scid-alias", + ScidAliasOptional: "scid-alias", + ZeroConfRequired: "zero-conf", + ZeroConfOptional: "zero-conf", } // RawFeatureVector represents a set of feature bits as defined in BOLT-09. A