feature: add feature sets for the wumbo channel feature bit

This commit is contained in:
Olaoluwa Osuntokun 2020-07-01 21:03:12 -07:00
parent 1b8fd008c4
commit 73cdb6a50f
No known key found for this signature in database
GPG Key ID: BC13F65E2DC84465
2 changed files with 12 additions and 1 deletions

View File

@ -47,4 +47,8 @@ var defaultSetDesc = setDesc{
SetInit: {}, // I
SetNodeAnn: {}, // N
},
lnwire.WumboChannelsOptional: {
SetInit: {}, // I
SetNodeAnn: {}, // N
},
}

View File

@ -20,6 +20,9 @@ type Config struct {
// NoAnchors unsets any bits signaling support for anchor outputs.
NoAnchors bool
// NoWumbo unsets any bits signalling support for wumbo channels.
NoWumbo bool
}
// Manager is responsible for generating feature vectors for different requested
@ -36,7 +39,7 @@ func NewManager(cfg Config) (*Manager, error) {
return newManager(cfg, defaultSetDesc)
}
// newManager creates a new feeature Manager, applying any custom modifications
// newManager creates a new feature Manager, applying any custom modifications
// to its feature sets before returning. This method accepts the setDesc as its
// own parameter so that it can be unit tested.
func newManager(cfg Config, desc setDesc) (*Manager, error) {
@ -83,6 +86,10 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
raw.Unset(lnwire.AnchorsOptional)
raw.Unset(lnwire.AnchorsRequired)
}
if cfg.NoWumbo {
raw.Unset(lnwire.WumboChannelsOptional)
raw.Unset(lnwire.WumboChannelsRequired)
}
// Ensure that all of our feature sets properly set any
// dependent features.