multi: announce Keysend feature bit

In this commit, we add the keysend feature bit to our NodeAnnouncement
if the accept-keysend option is set.
This commit is contained in:
Elle Mouton
2022-04-14 13:54:57 +02:00
parent d397e3e680
commit c54cc6e841
6 changed files with 32 additions and 2 deletions

View File

@@ -64,6 +64,9 @@ var defaultSetDesc = setDesc{
SetInit: {}, // I
SetNodeAnn: {}, // N
},
lnwire.KeysendOptional: {
SetNodeAnn: {}, // N
},
lnwire.ScriptEnforcedLeaseOptional: {
SetInit: {}, // I
SetNodeAnn: {}, // N

View File

@@ -69,6 +69,9 @@ var deps = depDesc{
lnwire.ExplicitChannelTypeOptional: {},
lnwire.AnchorsZeroFeeHtlcTxOptional: {},
},
lnwire.KeysendOptional: {
lnwire.TLVOnionPayloadOptional: {},
},
}
// ValidateDeps asserts that a feature vector sets all features and their

View File

@@ -27,6 +27,10 @@ type Config struct {
// NoScriptEnforcementLease unsets any bits signaling support for script
// enforced leases.
NoScriptEnforcementLease bool
// NoKeysend unsets any bits signaling support for accepting keysend
// payments.
NoKeysend bool
}
// Manager is responsible for generating feature vectors for different requested
@@ -83,6 +87,8 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
raw.Unset(lnwire.MPPRequired)
raw.Unset(lnwire.AMPOptional)
raw.Unset(lnwire.AMPRequired)
raw.Unset(lnwire.KeysendOptional)
raw.Unset(lnwire.KeysendRequired)
}
if cfg.NoStaticRemoteKey {
raw.Unset(lnwire.StaticRemoteKeyOptional)
@@ -115,6 +121,10 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) {
raw.Unset(lnwire.ScriptEnforcedLeaseOptional)
raw.Unset(lnwire.ScriptEnforcedLeaseRequired)
}
if cfg.NoKeysend {
raw.Unset(lnwire.KeysendOptional)
raw.Unset(lnwire.KeysendRequired)
}
// Ensure that all of our feature sets properly set any
// dependent features.