X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=lightning%2Fsrc%2Fln%2Ffeatures.rs;h=1f455471a9f4fa2bf3b30b9a1ade5ac54638bb72;hb=3e89cc7e085023b7e3c5ccd7f444700684e97dd2;hp=f630a86f99e5525e00dfcc7aa942df1b9bc1d85c;hpb=50aeee5afb57644432254122a921e438f10e92d5;p=rust-lightning diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index f630a86f9..1f455471a 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -158,6 +158,7 @@ mod sealed { BasicMPP, ]); define_context!(OfferContext, []); + define_context!(InvoiceRequestContext, []); // This isn't a "real" feature context, and is only used in the channel_type field in an // `OpenChannel` message. define_context!(ChannelTypeContext, [ @@ -367,7 +368,8 @@ mod sealed { supports_keysend, requires_keysend); #[cfg(test)] - define_feature!(123456789, UnknownFeature, [NodeContext, ChannelContext, InvoiceContext, OfferContext], + define_feature!(123456789, UnknownFeature, + [NodeContext, ChannelContext, InvoiceContext, OfferContext, InvoiceRequestContext], "Feature flags for an unknown feature used in testing.", set_unknown_feature_optional, set_unknown_feature_required, supports_unknown_test_feature, requires_unknown_test_feature); } @@ -426,8 +428,10 @@ pub type NodeFeatures = Features; pub type ChannelFeatures = Features; /// Features used within an invoice. pub type InvoiceFeatures = Features; -/// Features used within an offer. +/// Features used within an `offer`. pub type OfferFeatures = Features; +/// Features used within an `invoice_request`. +pub type InvoiceRequestFeatures = Features; /// Features used within the channel_type field in an OpenChannel message. /// @@ -687,6 +691,15 @@ impl Features { } } +#[cfg(test)] +impl Features { + pub(crate) fn unknown() -> Self { + let mut features = Self::empty(); + features.set_unknown_feature_required(); + features + } +} + macro_rules! impl_feature_len_prefixed_write { ($features: ident) => { impl Writeable for $features { @@ -726,6 +739,7 @@ macro_rules! impl_feature_tlv_write { impl_feature_tlv_write!(ChannelTypeFeatures); impl_feature_tlv_write!(OfferFeatures); +impl_feature_tlv_write!(InvoiceRequestFeatures); #[cfg(test)] mod tests {