Struct lightning_types::features::Features

source ·
pub struct Features<T: Context> { /* private fields */ }
Expand description

Tracks the set of features which a node implements, templated by the context in which it appears.

This is not exported to bindings users as we map the concrete feature types below directly instead

Implementations§

source§

impl<T: DataLossProtect> Features<T>

source

pub fn set_data_loss_protect_optional(&mut self)

Set this feature as optional.

source

pub fn set_data_loss_protect_required(&mut self)

Set this feature as required.

source

pub fn supports_data_loss_protect(&self) -> bool

Checks if this feature is supported.

source§

impl<T: DataLossProtect> Features<T>

source

pub fn requires_data_loss_protect(&self) -> bool

Checks if this feature is required.

source§

impl<T: InitialRoutingSync> Features<T>

source

pub fn set_initial_routing_sync_optional(&mut self)

Set this feature as optional.

source

pub fn set_initial_routing_sync_required(&mut self)

Set this feature as required.

source

pub fn initial_routing_sync(&self) -> bool

Checks if this feature is supported.

source§

impl<T: UpfrontShutdownScript> Features<T>

source

pub fn set_upfront_shutdown_script_optional(&mut self)

Set this feature as optional.

source

pub fn set_upfront_shutdown_script_required(&mut self)

Set this feature as required.

source

pub fn supports_upfront_shutdown_script(&self) -> bool

Checks if this feature is supported.

source§

impl<T: UpfrontShutdownScript> Features<T>

source

pub fn requires_upfront_shutdown_script(&self) -> bool

Checks if this feature is required.

source§

impl<T: GossipQueries> Features<T>

source

pub fn set_gossip_queries_optional(&mut self)

Set this feature as optional.

source

pub fn set_gossip_queries_required(&mut self)

Set this feature as required.

source

pub fn supports_gossip_queries(&self) -> bool

Checks if this feature is supported.

source§

impl<T: GossipQueries> Features<T>

source

pub fn requires_gossip_queries(&self) -> bool

Checks if this feature is required.

source§

impl<T: VariableLengthOnion> Features<T>

source

pub fn set_variable_length_onion_optional(&mut self)

Set this feature as optional.

source

pub fn set_variable_length_onion_required(&mut self)

Set this feature as required.

source

pub fn supports_variable_length_onion(&self) -> bool

Checks if this feature is supported.

source§

impl<T: VariableLengthOnion> Features<T>

source

pub fn requires_variable_length_onion(&self) -> bool

Checks if this feature is required.

source§

impl<T: StaticRemoteKey> Features<T>

source

pub fn set_static_remote_key_optional(&mut self)

Set this feature as optional.

source

pub fn set_static_remote_key_required(&mut self)

Set this feature as required.

source

pub fn supports_static_remote_key(&self) -> bool

Checks if this feature is supported.

source§

impl<T: StaticRemoteKey> Features<T>

source

pub fn requires_static_remote_key(&self) -> bool

Checks if this feature is required.

source§

impl<T: PaymentSecret> Features<T>

source

pub fn set_payment_secret_optional(&mut self)

Set this feature as optional.

source

pub fn set_payment_secret_required(&mut self)

Set this feature as required.

source

pub fn supports_payment_secret(&self) -> bool

Checks if this feature is supported.

source§

impl<T: PaymentSecret> Features<T>

source

pub fn requires_payment_secret(&self) -> bool

Checks if this feature is required.

source§

impl<T: BasicMPP> Features<T>

source

pub fn set_basic_mpp_optional(&mut self)

Set this feature as optional.

source

pub fn set_basic_mpp_required(&mut self)

Set this feature as required.

source

pub fn supports_basic_mpp(&self) -> bool

Checks if this feature is supported.

source§

impl<T: BasicMPP> Features<T>

source

pub fn requires_basic_mpp(&self) -> bool

Checks if this feature is required.

source§

impl<T: Wumbo> Features<T>

source

pub fn set_wumbo_optional(&mut self)

Set this feature as optional.

source

pub fn set_wumbo_required(&mut self)

Set this feature as required.

source

pub fn supports_wumbo(&self) -> bool

Checks if this feature is supported.

source§

impl<T: Wumbo> Features<T>

source

pub fn requires_wumbo(&self) -> bool

Checks if this feature is required.

source§

impl<T: AnchorsNonzeroFeeHtlcTx> Features<T>

source

pub fn set_anchors_nonzero_fee_htlc_tx_optional(&mut self)

Set this feature as optional.

source

pub fn set_anchors_nonzero_fee_htlc_tx_required(&mut self)

Set this feature as required.

source

pub fn supports_anchors_nonzero_fee_htlc_tx(&self) -> bool

Checks if this feature is supported.

source§

impl<T: AnchorsNonzeroFeeHtlcTx> Features<T>

source

pub fn requires_anchors_nonzero_fee_htlc_tx(&self) -> bool

Checks if this feature is required.

source§

impl<T: AnchorsZeroFeeHtlcTx> Features<T>

source

pub fn set_anchors_zero_fee_htlc_tx_optional(&mut self)

Set this feature as optional.

source

pub fn set_anchors_zero_fee_htlc_tx_required(&mut self)

Set this feature as required.

source

pub fn supports_anchors_zero_fee_htlc_tx(&self) -> bool

Checks if this feature is supported.

source§

impl<T: AnchorsZeroFeeHtlcTx> Features<T>

source

pub fn requires_anchors_zero_fee_htlc_tx(&self) -> bool

Checks if this feature is required.

source§

impl<T: RouteBlinding> Features<T>

source

pub fn set_route_blinding_optional(&mut self)

Set this feature as optional.

source

pub fn set_route_blinding_required(&mut self)

Set this feature as required.

source

pub fn supports_route_blinding(&self) -> bool

Checks if this feature is supported.

source§

impl<T: RouteBlinding> Features<T>

source

pub fn requires_route_blinding(&self) -> bool

Checks if this feature is required.

source§

impl<T: ShutdownAnySegwit> Features<T>

source

pub fn set_shutdown_any_segwit_optional(&mut self)

Set this feature as optional.

source

pub fn set_shutdown_any_segwit_required(&mut self)

Set this feature as required.

source

pub fn supports_shutdown_anysegwit(&self) -> bool

Checks if this feature is supported.

source§

impl<T: ShutdownAnySegwit> Features<T>

source

pub fn requires_shutdown_anysegwit(&self) -> bool

Checks if this feature is required.

source§

impl<T: Taproot> Features<T>

source

pub fn set_taproot_optional(&mut self)

Set this feature as optional.

source

pub fn set_taproot_required(&mut self)

Set this feature as required.

source

pub fn supports_taproot(&self) -> bool

Checks if this feature is supported.

source§

impl<T: Taproot> Features<T>

source

pub fn requires_taproot(&self) -> bool

Checks if this feature is required.

source§

impl<T: OnionMessages> Features<T>

source

pub fn set_onion_messages_optional(&mut self)

Set this feature as optional.

source

pub fn set_onion_messages_required(&mut self)

Set this feature as required.

source

pub fn supports_onion_messages(&self) -> bool

Checks if this feature is supported.

source§

impl<T: OnionMessages> Features<T>

source

pub fn requires_onion_messages(&self) -> bool

Checks if this feature is required.

source§

impl<T: ChannelType> Features<T>

source

pub fn set_channel_type_optional(&mut self)

Set this feature as optional.

source

pub fn set_channel_type_required(&mut self)

Set this feature as required.

source

pub fn supports_channel_type(&self) -> bool

Checks if this feature is supported.

source§

impl<T: ChannelType> Features<T>

source

pub fn requires_channel_type(&self) -> bool

Checks if this feature is required.

source§

impl<T: SCIDPrivacy> Features<T>

source

pub fn set_scid_privacy_optional(&mut self)

Set this feature as optional.

source

pub fn set_scid_privacy_required(&mut self)

Set this feature as required.

source

pub fn supports_scid_privacy(&self) -> bool

Checks if this feature is supported.

source§

impl<T: SCIDPrivacy> Features<T>

source

pub fn requires_scid_privacy(&self) -> bool

Checks if this feature is required.

source§

impl<T: PaymentMetadata> Features<T>

source

pub fn set_payment_metadata_optional(&mut self)

Set this feature as optional.

source

pub fn set_payment_metadata_required(&mut self)

Set this feature as required.

source

pub fn supports_payment_metadata(&self) -> bool

Checks if this feature is supported.

source§

impl<T: PaymentMetadata> Features<T>

source

pub fn requires_payment_metadata(&self) -> bool

Checks if this feature is required.

source§

impl<T: ZeroConf> Features<T>

source

pub fn set_zero_conf_optional(&mut self)

Set this feature as optional.

source

pub fn set_zero_conf_required(&mut self)

Set this feature as required.

source

pub fn supports_zero_conf(&self) -> bool

Checks if this feature is supported.

source§

impl<T: ZeroConf> Features<T>

source

pub fn requires_zero_conf(&self) -> bool

Checks if this feature is required.

source§

impl<T: Keysend> Features<T>

source

pub fn set_keysend_optional(&mut self)

Set this feature as optional.

source

pub fn set_keysend_required(&mut self)

Set this feature as required.

source

pub fn supports_keysend(&self) -> bool

Checks if this feature is supported.

source§

impl<T: Keysend> Features<T>

source

pub fn requires_keysend(&self) -> bool

Checks if this feature is required.

source§

impl<T: Trampoline> Features<T>

source

pub fn set_trampoline_routing_optional(&mut self)

Set this feature as optional.

source

pub fn set_trampoline_routing_required(&mut self)

Set this feature as required.

source

pub fn supports_trampoline_routing(&self) -> bool

Checks if this feature is supported.

source§

impl<T: Trampoline> Features<T>

source

pub fn requires_trampoline_routing(&self) -> bool

Checks if this feature is required.

source§

impl Features<Bolt11InvoiceContext>

source

pub fn for_keysend(allow_mpp: bool) -> Bolt11InvoiceFeatures

Getting a route for a keysend payment to a private node requires providing the payee’s features (since they were not announced in a node announcement). However, keysend payments don’t have an invoice to pull the payee’s features from, so this method is provided for use when a Bolt11InvoiceFeatures is required in a 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.

source§

impl Features<ChannelTypeContext>

source

pub fn only_static_remote_key() -> Self

Constructs a ChannelTypeFeatures with only static_remotekey set

source

pub fn anchors_zero_htlc_fee_and_dependencies() -> Self

Constructs a ChannelTypeFeatures with anchors support

source§

impl<T: Context> Features<T>

source

pub fn empty() -> Self

Create a blank Features with no features set

source

pub fn from_le_bytes(flags: Vec<u8>) -> Features<T>

Create a Features given a set of flags, in little-endian. This is in reverse byte order from most on-the-wire encodings.

This is not exported to bindings users as we don’t support export across multiple T

source

pub fn le_flags(&self) -> &[u8]

Returns the feature set as a list of bytes, in little-endian. This is in reverse byte order from most on-the-wire encodings.

source

pub fn from_be_bytes(flags: Vec<u8>) -> Features<T>

Create a Features given a set of flags, in big-endian. This is in byte order from most on-the-wire encodings.

This is not exported to bindings users as we don’t support export across multiple T

source

pub fn supports_any_optional_bits(&self) -> bool

Returns true if this Features has any optional flags set

source

pub fn requires_unknown_bits_from(&self, other: &Self) -> bool

Returns true if this Features object contains required features unknown by other.

source

pub fn required_unknown_bits_from(&self, other: &Self) -> Vec<u64>

Returns the set of required features unknown by other, as their bit position.

source

pub fn requires_unknown_bits(&self) -> bool

Returns true if this Features object contains unknown feature flags which are set as “required”.

source

pub fn supports_unknown_bits(&self) -> bool

Returns true if this Features supports any bits which we do not know of

source

pub fn set_required_feature_bit(&mut self, bit: usize) -> Result<(), ()>

Sets a required feature bit. Errors if bit is outside the feature range as defined by BOLT 9.

Note: Required bits are even. If an odd bit is given, then the corresponding even bit will be set instead (i.e., bit - 1).

source

pub fn set_optional_feature_bit(&mut self, bit: usize) -> Result<(), ()>

Sets an optional feature bit. Errors if bit is outside the feature range as defined by BOLT 9.

Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be set instead (i.e., bit + 1).

source

pub fn set_required_custom_bit(&mut self, bit: usize) -> Result<(), ()>

Sets a required custom feature bit. Errors if bit is outside the custom range as defined by bLIP 2 or if it is a known T feature.

Note: Required bits are even. If an odd bit is given, then the corresponding even bit will be set instead (i.e., bit - 1).

source

pub fn set_optional_custom_bit(&mut self, bit: usize) -> Result<(), ()>

Sets an optional custom feature bit. Errors if bit is outside the custom range as defined by bLIP 2 or if it is a known T feature.

Note: Optional bits are odd. If an even bit is given, then the corresponding odd bit will be set instead (i.e., bit + 1).

source§

impl<T: UpfrontShutdownScript> Features<T>

source

pub fn clear_upfront_shutdown_script(self) -> Self

Unsets the upfront_shutdown_script feature

source§

impl<T: ShutdownAnySegwit> Features<T>

source

pub fn clear_shutdown_anysegwit(self) -> Self

Unsets the shutdown_anysegwit feature

source§

impl<T: Wumbo> Features<T>

source

pub fn clear_wumbo(self) -> Self

Unsets the wumbo feature

source§

impl<T: SCIDPrivacy> Features<T>

source

pub fn clear_scid_privacy(&mut self)

Unsets the scid_privacy feature

source§

impl<T: AnchorsZeroFeeHtlcTx> Features<T>

source

pub fn clear_anchors_zero_fee_htlc_tx(&mut self)

Unsets the anchors_zero_fee_htlc_tx feature

source§

impl<T: RouteBlinding> Features<T>

source

pub fn clear_route_blinding(&mut self)

Unsets the route_blinding feature

Trait Implementations§

source§

impl<T: Context> BitOr for Features<T>

source§

type Output = Features<T>

The resulting type after applying the | operator.
source§

fn bitor(self, o: Self) -> Self

Performs the | operation. Read more
source§

impl<T: Context, Rhs: Borrow<Self>> BitOrAssign<Rhs> for Features<T>

source§

fn bitor_assign(&mut self, rhs: Rhs)

Performs the |= operation. Read more
source§

impl<T: Context> Clone for Features<T>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Context> Debug for Features<T>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<BlindedHopContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<Bolt11InvoiceContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<Bolt12InvoiceContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<ChannelContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<ChannelTypeContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<InitContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<InvoiceRequestContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<NodeContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for Features<OfferContext>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<T: Context> Hash for Features<T>

source§

fn hash<H: Hasher>(&self, hasher: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: Context + Eq> Ord for Features<T>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: Context> PartialEq for Features<T>

source§

fn eq(&self, o: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Context> PartialOrd for Features<T>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: Eq + Context> Eq for Features<T>

Auto Trait Implementations§

§

impl<T> Freeze for Features<T>

§

impl<T> RefUnwindSafe for Features<T>
where T: RefUnwindSafe,

§

impl<T> Send for Features<T>
where T: Send,

§

impl<T> Sync for Features<T>
where T: Sync,

§

impl<T> Unpin for Features<T>
where T: Unpin,

§

impl<T> UnwindSafe for Features<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.