diff --git a/feature/default_sets.go b/feature/default_sets.go index 50b503f8..4c0de569 100644 --- a/feature/default_sets.go +++ b/feature/default_sets.go @@ -51,4 +51,9 @@ var defaultSetDesc = setDesc{ SetInit: {}, // I SetNodeAnn: {}, // N }, + lnwire.AMPOptional: { + SetInit: {}, // I + SetNodeAnn: {}, // N + SetInvoice: {}, // 9 + }, } diff --git a/feature/deps.go b/feature/deps.go index c2b8f175..51ee37e9 100644 --- a/feature/deps.go +++ b/feature/deps.go @@ -58,6 +58,9 @@ var deps = depDesc{ lnwire.AnchorsOptional: { lnwire.StaticRemoteKeyOptional: {}, }, + lnwire.AMPOptional: { + lnwire.PaymentAddrOptional: {}, + }, } // ValidateDeps asserts that a feature vector sets all features and their diff --git a/feature/manager.go b/feature/manager.go index cbaf8f57..98918071 100644 --- a/feature/manager.go +++ b/feature/manager.go @@ -77,6 +77,8 @@ func newManager(cfg Config, desc setDesc) (*Manager, error) { raw.Unset(lnwire.PaymentAddrRequired) raw.Unset(lnwire.MPPOptional) raw.Unset(lnwire.MPPRequired) + raw.Unset(lnwire.AMPOptional) + raw.Unset(lnwire.AMPRequired) } if cfg.NoStaticRemoteKey { raw.Unset(lnwire.StaticRemoteKeyOptional) diff --git a/lnwire/features.go b/lnwire/features.go index 279e72c9..9dfa07ee 100644 --- a/lnwire/features.go +++ b/lnwire/features.go @@ -129,6 +129,16 @@ const ( // transactions, which also imply anchor commitments. AnchorsZeroFeeHtlcTxOptional FeatureBit = 23 + // AMPRequired is a required feature bit that signals that the receiver + // of a payment supports accepts spontaneous payments, i.e. + // sender-generated preimages according to BOLT XX. + AMPRequired FeatureBit = 30 + + // AMPOptional is an optional feature bit that signals that the receiver + // of a payment supports accepts spontaneous payments, i.e. + // sender-generated preimages according to BOLT XX. + AMPOptional FeatureBit = 31 + // maxAllowedSize is a maximum allowed size of feature vector. // // NOTE: Within the protocol, the maximum allowed message size is 65535 @@ -172,6 +182,8 @@ var Features = map[FeatureBit]string{ AnchorsZeroFeeHtlcTxOptional: "anchors-zero-fee-htlc-tx", WumboChannelsRequired: "wumbo-channels", WumboChannelsOptional: "wumbo-channels", + AMPRequired: "amp", + AMPOptional: "amp", } // RawFeatureVector represents a set of feature bits as defined in BOLT-09. A