self.flags.eq(&o.flags)
}
}
+impl<T: sealed::Context> PartialOrd for Features<T> {
+ fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
+ self.flags.partial_cmp(&other.flags)
+ }
+}
+impl<T: sealed::Context + Eq> Ord for Features<T> {
+ fn cmp(&self, other: &Self) -> cmp::Ordering {
+ self.flags.cmp(&other.flags)
+ }
+}
impl<T: sealed::Context> fmt::Debug for Features<T> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
self.flags.fmt(fmt)
/// [`PaymentParameters::for_keysend`], thus omitting the need for payers to manually construct an
/// `InvoiceFeatures` for [`find_route`].
///
+ /// MPP keysend is not widely supported yet, so we parameterize support to allow the user to
+ /// choose whether their router should find multi-part routes.
+ ///
/// [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
/// [`find_route`]: crate::routing::router::find_route
- pub(crate) fn for_keysend() -> InvoiceFeatures {
+ pub(crate) fn for_keysend(allow_mpp: bool) -> InvoiceFeatures {
let mut res = InvoiceFeatures::empty();
res.set_variable_length_onion_optional();
+ if allow_mpp {
+ res.set_basic_mpp_optional();
+ }
res
}
}
+impl Bolt12InvoiceFeatures {
+ /// Converts `Bolt12InvoiceFeatures` to `Features<C>`. Only known `Bolt12InvoiceFeatures` relevant
+ /// to context `C` are included in the result.
+ pub(crate) fn to_context<C: sealed::Context>(&self) -> Features<C> {
+ self.to_context_internal()
+ }
+}
+
impl ChannelTypeFeatures {
// Maps the relevant `InitFeatures` to `ChannelTypeFeatures`. Any unknown features to
// `ChannelTypeFeatures` are not included in the result.
impl_feature_len_prefixed_write!(ChannelFeatures);
impl_feature_len_prefixed_write!(NodeFeatures);
impl_feature_len_prefixed_write!(InvoiceFeatures);
+impl_feature_len_prefixed_write!(Bolt12InvoiceFeatures);
impl_feature_len_prefixed_write!(BlindedHopFeatures);
// Some features only appear inside of TLVs, so they don't have a length prefix when serialized.