Define `ChannelTypeFeatures` methods for anchors logic.
authorArik Sosman <git@arik.io>
Mon, 19 Jun 2023 17:28:36 +0000 (10:28 -0700)
committerArik Sosman <git@arik.io>
Thu, 22 Jun 2023 22:23:11 +0000 (15:23 -0700)
Specifically, introduce a new constructor for an anchors-
supporting feature set, as well as methods that will
maintain forwards-compatible deserialization in older
versions.

lightning/src/ln/features.rs

index 3e3484e7372fc4a9ee59adaa01eb35badec11416..714bfaa5528fab5a5144cd9e54b827bb7de3b422 100644 (file)
@@ -594,6 +594,15 @@ impl ChannelTypeFeatures {
                <sealed::ChannelTypeContext as sealed::StaticRemoteKey>::set_required_bit(&mut ret.flags);
                ret
        }
+
+       #[cfg(any(anchors, test))]
+       /// Constructs a ChannelTypeFeatures with anchors support
+       pub(crate) fn anchors_zero_htlc_fee_and_dependencies() -> Self {
+               let mut ret = Self::empty();
+               <sealed::ChannelTypeContext as sealed::StaticRemoteKey>::set_required_bit(&mut ret.flags);
+               <sealed::ChannelTypeContext as sealed::AnchorsZeroFeeHtlcTx>::set_required_bit(&mut ret.flags);
+               ret
+       }
 }
 
 impl ToBase32 for InvoiceFeatures {