breez_sdk_liquid::lightning::util::config

Struct ChannelConfig

pub struct ChannelConfig {
    pub forwarding_fee_proportional_millionths: u32,
    pub forwarding_fee_base_msat: u32,
    pub cltv_expiry_delta: u16,
    pub max_dust_htlc_exposure: MaxDustHTLCExposure,
    pub force_close_avoidance_max_fee_satoshis: u64,
    pub accept_underpaying_htlcs: bool,
}
Expand description

Options which apply on a per-channel basis and may change at runtime or based on negotiation with our counterparty.

Fields§

§forwarding_fee_proportional_millionths: u32

Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound over the channel. This may be allowed to change at runtime in a later update, however doing so must result in update messages sent to notify all nodes of our updated relay fee.

Default value: 0.

§forwarding_fee_base_msat: u32

Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in excess of forwarding_fee_proportional_millionths. This may be allowed to change at runtime in a later update, however doing so must result in update messages sent to notify all nodes of our updated relay fee.

The default value of a single satoshi roughly matches the market rate on many routing nodes as of July 2021. Adjusting it upwards or downwards may change whether nodes route through this node.

Default value: 1000.

§cltv_expiry_delta: u16

The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over the channel this config applies to.

This is analogous to ChannelHandshakeConfig::our_to_self_delay but applies to in-flight HTLC balance when a channel appears on-chain whereas ChannelHandshakeConfig::our_to_self_delay applies to the remaining (non-HTLC-encumbered) balance.

Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed, we (or one of our watchtowers) MUST be online to check for broadcast of the current commitment transaction at least once per this many blocks (minus some margin to allow us enough time to broadcast and confirm a transaction, possibly with time in between to RBF the spending transaction).

Default value: 72 (12 hours at an average of 6 blocks/hour). Minimum value: MIN_CLTV_EXPIRY_DELTA, any values less than this will be treated as MIN_CLTV_EXPIRY_DELTA instead.

§max_dust_htlc_exposure: MaxDustHTLCExposure

Limit our total exposure to in-flight HTLCs which are burned to fees as they are too small to claim on-chain.

When an HTLC present in one of our channels is below a “dust” threshold, the HTLC will not be claimable on-chain, instead being turned into additional miner fees if either party force-closes the channel. Because the threshold is per-HTLC, our total exposure to such payments may be sustantial if there are many dust HTLCs present when the channel is force-closed.

The dust threshold for each HTLC is based on the dust_limit_satoshis for each party in a channel negotiated throughout the channel open process, along with the fees required to have a broadcastable HTLC spending transaction. When a channel supports anchor outputs (specifically the zero fee HTLC transaction variant), this threshold no longer takes into account the HTLC transaction fee as it is zero. Because of this, you may want to set this value to a fixed limit for channels using anchor outputs, while the fee rate multiplier variant is primarily intended for use with pre-anchor channels.

The selected limit is applied for sent, forwarded, and received HTLCs and limits the total exposure across all three types per-channel.

Default value: MaxDustHTLCExposure::FeeRateMultiplier with a multiplier of 5000.

§force_close_avoidance_max_fee_satoshis: u64

The additional fee we’re willing to pay to avoid waiting for the counterparty’s to_self_delay to reclaim funds.

When we close a channel cooperatively with our counterparty, we negotiate a fee for the closing transaction which both sides find acceptable, ultimately paid by the channel funder/initiator.

When we are the funder, because we have to pay the channel closing fee, we bound the acceptable fee by our ChannelCloseMinimum and NonAnchorChannelFee fees, with the upper bound increased by this value. Because the on-chain fee we’d pay to force-close the channel is kept near our NonAnchorChannelFee feerate during normal operation, this value represents the additional fee we’re willing to pay in order to avoid waiting for our counterparty’s to_self_delay to reclaim our funds.

When we are not the funder, we require the closing transaction fee pay at least our ChannelCloseMinimum fee estimate, but allow our counterparty to pay as much fee as they like. Thus, this value is ignored when we are not the funder.

Default value: 1000 satoshis.

§accept_underpaying_htlcs: bool

If set, allows this channel’s counterparty to skim an additional fee off this node’s inbound HTLCs. Useful for liquidity providers to offload on-chain channel costs to end users.

Usage:

§Note

It’s important for payee wallet software to verify that PaymentClaimable::amount_msat is as-expected if this feature is activated, otherwise they may lose money! PaymentClaimable::counterparty_skimmed_fee_msat provides the fee taken by the counterparty.

§Note

Switching this config flag on may break compatibility with versions of LDK prior to 0.0.116. Unsetting this flag between restarts may lead to payment receive failures.

Default value: false.

Implementations§

§

impl ChannelConfig

pub fn apply(&mut self, update: &ChannelConfigUpdate)

Applies the given ChannelConfigUpdate as a partial update to the ChannelConfig.

Trait Implementations§

§

impl Clone for ChannelConfig

§

fn clone(&self) -> ChannelConfig

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
§

impl Debug for ChannelConfig

§

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

Formats the value using the given formatter. Read more
§

impl Default for ChannelConfig

§

fn default() -> ChannelConfig

Provides sane defaults for most configurations (but with zero relay fees!).

§

impl From<ChannelConfig> for ChannelConfigUpdate

§

fn from(config: ChannelConfig) -> ChannelConfigUpdate

Converts to this type from the input type.
§

impl PartialEq for ChannelConfig

§

fn eq(&self, other: &ChannelConfig) -> 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.
§

impl Readable for ChannelConfig

§

fn read<R>(reader: &mut R) -> Result<ChannelConfig, DecodeError>
where R: Read,

Reads a Self in from the given Read.
§

impl Writeable for ChannelConfig

§

fn write<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Writer,

Writes self out to the given Writer.
§

fn encode(&self) -> Vec<u8>

Writes self out to a Vec<u8>.
§

fn serialized_length(&self) -> usize

Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length.
§

impl Copy for ChannelConfig

§

impl Eq for ChannelConfig

§

impl StructuralPartialEq for ChannelConfig

Auto Trait Implementations§

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> MaybeReadable for T
where T: Readable,

§

fn read<R>(reader: &mut R) -> Result<Option<T>, DecodeError>
where R: Read,

Reads a Self in from the given Read.
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DartSafe for T

§

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