lnwire+feature: new zero-conf, scid-alias feature bit + chantypes

This defines the zero-conf feature bit, the scid-alias feature bit,
the zero-conf channel type, and the scid-alias channel type. It also
defines the dependency "tree" that exists for the feature bits.

The scid-alias feature bit signals that the node requires an alias
short channel id to be sent in funding_locked. The scid-alias channel
type requires that the channel is private, in addition to some other
forwarding-related privacy measures.
This commit is contained in:
eugene
2022-04-04 15:16:13 -04:00
parent dc35f78ebc
commit a6c62eb71e
4 changed files with 54 additions and 1 deletions

View File

@@ -71,4 +71,12 @@ var defaultSetDesc = setDesc{
SetInit: {}, // I
SetNodeAnn: {}, // N
},
lnwire.ScidAliasOptional: {
SetInit: {}, // I
SetNodeAnn: {}, // N
},
lnwire.ZeroConfOptional: {
SetInit: {}, // I
SetNodeAnn: {}, // N
},
}

View File

@@ -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

View File

@@ -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.