X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Ffeatures.rs;h=8f3d5cb5a24f1b7bf5b3baf160e08eab6091f323;hb=bd16a1e409413ed0762d87c166819ad1fa62fa8b;hp=79f869a4c5864761f6b1438ce8e3d6613e9e0a0a;hpb=e40387fc856d9b62bb89d37df139d0310459eb82;p=rust-lightning diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index 79f869a4..8f3d5cb5 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -66,6 +66,8 @@ //! for more info). //! - `Keysend` - send funds to a node without an invoice //! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information). +//! - `Trampoline` - supports receiving and forwarding Trampoline payments +//! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information). //! //! LDK knows about the following features, but does not support them: //! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be @@ -76,19 +78,21 @@ //! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md //! [messages]: crate::ln::msgs -use crate::{io, io_extras}; +#[allow(unused_imports)] use crate::prelude::*; + +use crate::{io, io_extras}; use core::{cmp, fmt}; use core::borrow::Borrow; use core::hash::{Hash, Hasher}; use core::marker::PhantomData; -use bitcoin::bech32; -use bitcoin::bech32::{Base32Len, FromBase32, ToBase32, u5, WriteBase32}; +use bech32::{Base32Len, FromBase32, ToBase32, u5, WriteBase32}; use crate::ln::msgs::DecodeError; use crate::util::ser::{Readable, WithoutLength, Writeable, Writer}; mod sealed { + #[allow(unused_imports)] use crate::prelude::*; use crate::ln::features::Features; @@ -152,6 +156,8 @@ mod sealed { ChannelType | SCIDPrivacy, // Byte 6 ZeroConf, + // Byte 7 + Trampoline, ]); define_context!(NodeContext, [ // Byte 0 @@ -168,6 +174,8 @@ mod sealed { ChannelType | SCIDPrivacy, // Byte 6 ZeroConf | Keysend, + // Byte 7 + Trampoline, ]); define_context!(ChannelContext, []); define_context!(Bolt11InvoiceContext, [ @@ -185,6 +193,8 @@ mod sealed { , // Byte 6 PaymentMetadata, + // Byte 7 + Trampoline, ]); define_context!(OfferContext, []); define_context!(InvoiceRequestContext, []); @@ -420,6 +430,9 @@ mod sealed { define_feature!(55, Keysend, [NodeContext], "Feature flags for keysend payments.", set_keysend_optional, set_keysend_required, supports_keysend, requires_keysend); + define_feature!(57, Trampoline, [InitContext, NodeContext, Bolt11InvoiceContext], + "Feature flags for Trampoline routing.", set_trampoline_routing_optional, set_trampoline_routing_required, + supports_trampoline_routing, requires_trampoline_routing); // Note: update the module-level docs when a new feature bit is added! #[cfg(test)] @@ -1007,7 +1020,7 @@ impl Readable for WithoutLength> { #[cfg(test)] mod tests { use super::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, Bolt11InvoiceFeatures, NodeFeatures, OfferFeatures, sealed}; - use bitcoin::bech32::{Base32Len, FromBase32, ToBase32, u5}; + use bech32::{Base32Len, FromBase32, ToBase32, u5}; use crate::util::ser::{Readable, WithoutLength, Writeable}; #[test]