Define ChannelTypeFeatures methods for anchors logic.

Specifically, introduce a new constructor for an anchors-
supporting feature set, as well as methods that will
maintain forwards-compatible deserialization in older
versions.
This commit is contained in:
Arik Sosman 2023-06-19 10:28:36 -07:00
parent bf2218260e
commit 06a720fa7f
No known key found for this signature in database
GPG key ID: F4FB5A3366C4D92E

View file

@ -594,6 +594,15 @@ impl ChannelTypeFeatures {
<sealed::ChannelTypeContext as sealed::StaticRemoteKey>::set_required_bit(&mut ret.flags); <sealed::ChannelTypeContext as sealed::StaticRemoteKey>::set_required_bit(&mut ret.flags);
ret 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 { impl ToBase32 for InvoiceFeatures {