X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Ffeatures.rs;fp=lightning%2Fsrc%2Fln%2Ffeatures.rs;h=eb0100db675de8842e1d317d4a2b9c5c6e7b9ab1;hb=0b4079df9a2d4fd7b178f7441c5fb89d79e40a4d;hp=5d908ee01a4957bd7c85d305043af8e5204523a2;hpb=d37b1dd6730535cebe0ce5d0434046848b244211;p=rust-lightning diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index 5d908ee0..eb0100db 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -124,6 +124,12 @@ mod sealed { , // Byte 3 , + // Byte 4 + , + // Byte 5 + , + // Byte 6 + , ], optional_features: [ // Byte 0 @@ -134,6 +140,12 @@ mod sealed { BasicMPP, // Byte 3 ShutdownAnySegwit, + // Byte 4 + , + // Byte 5 + , + // Byte 6 + Keysend, ], }); define_context!(ChannelContext { @@ -299,6 +311,8 @@ mod sealed { define_feature!(27, ShutdownAnySegwit, [InitContext, NodeContext], "Feature flags for `opt_shutdown_anysegwit`.", set_shutdown_any_segwit_optional, set_shutdown_any_segwit_required); + define_feature!(55, Keysend, [NodeContext], + "Feature flags for keysend payments.", set_keysend_optional, set_keysend_required); #[cfg(test)] define_feature!(123456789, UnknownFeature, [NodeContext, ChannelContext, InvoiceContext], @@ -386,6 +400,18 @@ impl InvoiceFeatures { pub(crate) fn to_context(&self) -> Features { self.to_context_internal() } + + /// Getting a route for a keysend payment to a private node requires providing the payee's + /// features (since they were not announced in a node announcement). However, keysend payments + /// don't have an invoice to pull the payee's features from, so this method is provided for use in + /// [`get_keysend_route`], thus omitting the need for payers to manually construct an + /// `InvoiceFeatures` for [`get_route`]. + /// + /// [`get_keysend_route`]: crate::routing::router::get_keysend_route + /// [`get_route`]: crate::routing::router::get_route + pub(crate) fn for_keysend() -> InvoiceFeatures { + InvoiceFeatures::empty().set_variable_length_onion_optional() + } } impl ToBase32 for InvoiceFeatures {