/// [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
/// [`find_route`]: crate::routing::router::find_route
pub(crate) fn for_keysend() -> InvoiceFeatures {
/// [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend
/// [`find_route`]: crate::routing::router::find_route
pub(crate) fn for_keysend() -> InvoiceFeatures {
fn convert_to_context_with_unknown_flags() {
// Ensure the `from` context has fewer known feature bytes than the `to` context.
assert!(InvoiceFeatures::known().flags.len() < NodeFeatures::known().flags.len());
fn convert_to_context_with_unknown_flags() {
// Ensure the `from` context has fewer known feature bytes than the `to` context.
assert!(InvoiceFeatures::known().flags.len() < NodeFeatures::known().flags.len());
assert!(invoice_features.supports_unknown_bits());
let node_features: NodeFeatures = invoice_features.to_context();
assert!(!node_features.supports_unknown_bits());
assert!(invoice_features.supports_unknown_bits());
let node_features: NodeFeatures = invoice_features.to_context();
assert!(!node_features.supports_unknown_bits());
- let features = InvoiceFeatures::empty()
- .set_basic_mpp_optional()
- .set_payment_secret_required();
+ let mut features = InvoiceFeatures::empty();
+ features.set_basic_mpp_optional();
+ features.set_payment_secret_required();
assert!(features.supports_basic_mpp());
assert!(!features.requires_basic_mpp());
assert!(features.requires_payment_secret());
assert!(features.supports_basic_mpp());
assert!(!features.requires_basic_mpp());
assert!(features.requires_payment_secret());
fn test_channel_type_mapping() {
// If we map an InvoiceFeatures with StaticRemoteKey optional, it should map into a
// required-StaticRemoteKey ChannelTypeFeatures.
fn test_channel_type_mapping() {
// If we map an InvoiceFeatures with StaticRemoteKey optional, it should map into a
// required-StaticRemoteKey ChannelTypeFeatures.
let converted_features = ChannelTypeFeatures::from_counterparty_init(&init_features);
assert_eq!(converted_features, ChannelTypeFeatures::only_static_remote_key());
assert!(!converted_features.supports_any_optional_bits());
let converted_features = ChannelTypeFeatures::from_counterparty_init(&init_features);
assert_eq!(converted_features, ChannelTypeFeatures::only_static_remote_key());
assert!(!converted_features.supports_any_optional_bits());