Enum LightningBalance

Source
pub enum LightningBalance {
    ClaimableOnChannelClose {
        channel_id: ChannelId,
        counterparty_node_id: PublicKey,
        amount_satoshis: u64,
        transaction_fee_satoshis: u64,
        outbound_payment_htlc_rounded_msat: u64,
        outbound_forwarded_htlc_rounded_msat: u64,
        inbound_claiming_htlc_rounded_msat: u64,
        inbound_htlc_rounded_msat: u64,
    },
    ClaimableAwaitingConfirmations {
        channel_id: ChannelId,
        counterparty_node_id: PublicKey,
        amount_satoshis: u64,
        confirmation_height: u32,
        source: BalanceSource,
    },
    ContentiousClaimable {
        channel_id: ChannelId,
        counterparty_node_id: PublicKey,
        amount_satoshis: u64,
        timeout_height: u32,
        payment_hash: PaymentHash,
        payment_preimage: PaymentPreimage,
    },
    MaybeTimeoutClaimableHTLC {
        channel_id: ChannelId,
        counterparty_node_id: PublicKey,
        amount_satoshis: u64,
        claimable_height: u32,
        payment_hash: PaymentHash,
        outbound_payment: bool,
    },
    MaybePreimageClaimableHTLC {
        channel_id: ChannelId,
        counterparty_node_id: PublicKey,
        amount_satoshis: u64,
        expiry_height: u32,
        payment_hash: PaymentHash,
    },
    CounterpartyRevokedOutputClaimable {
        channel_id: ChannelId,
        counterparty_node_id: PublicKey,
        amount_satoshis: u64,
    },
}
Expand description

Details about the status of a known Lightning balance.

Variants§

§

ClaimableOnChannelClose

The channel is not yet closed (or the commitment or closing transaction has not yet appeared in a block). The given balance is claimable (less on-chain fees) if the channel is force-closed now.

Fields

§channel_id: ChannelId

The identifier of the channel this balance belongs to.

§counterparty_node_id: PublicKey

The identifier of our channel counterparty.

§amount_satoshis: u64

The amount available to claim, in satoshis, excluding the on-chain fees which will be required to do so.

§transaction_fee_satoshis: u64

The transaction fee we pay for the closing commitment transaction. This amount is not included in the amount_satoshis value.

Note that if this channel is inbound (and thus our counterparty pays the commitment transaction fee) this value will be zero. For channels created prior to LDK Node 0.4 the channel is always treated as outbound (and thus this value is never zero).

§outbound_payment_htlc_rounded_msat: u64

The amount of millisatoshis which has been burned to fees from HTLCs which are outbound from us and are related to a payment which was sent by us. This is the sum of the millisatoshis part of all HTLCs which are otherwise represented by LightningBalance::MaybeTimeoutClaimableHTLC with their LightningBalance::MaybeTimeoutClaimableHTLC::outbound_payment flag set, as well as any dust HTLCs which would otherwise be represented the same.

This amount (rounded up to a whole satoshi value) will not be included in amount_satoshis.

§outbound_forwarded_htlc_rounded_msat: u64

The amount of millisatoshis which has been burned to fees from HTLCs which are outbound from us and are related to a forwarded HTLC. This is the sum of the millisatoshis part of all HTLCs which are otherwise represented by LightningBalance::MaybeTimeoutClaimableHTLC with their LightningBalance::MaybeTimeoutClaimableHTLC::outbound_payment flag not set, as well as any dust HTLCs which would otherwise be represented the same.

This amount (rounded up to a whole satoshi value) will not be included in amount_satoshis.

§inbound_claiming_htlc_rounded_msat: u64

The amount of millisatoshis which has been burned to fees from HTLCs which are inbound to us and for which we know the preimage. This is the sum of the millisatoshis part of all HTLCs which would be represented by LightningBalance::ContentiousClaimable on channel close, but whose current value is included in amount_satoshis, as well as any dust HTLCs which would otherwise be represented the same.

This amount (rounded up to a whole satoshi value) will not be included in the counterparty’s amount_satoshis.

§inbound_htlc_rounded_msat: u64

The amount of millisatoshis which has been burned to fees from HTLCs which are inbound to us and for which we do not know the preimage. This is the sum of the millisatoshis part of all HTLCs which would be represented by LightningBalance::MaybePreimageClaimableHTLC on channel close, as well as any dust HTLCs which would otherwise be represented the same.

This amount (rounded up to a whole satoshi value) will not be included in the counterparty’s amount_satoshis.

§

ClaimableAwaitingConfirmations

The channel has been closed, and the given balance is ours but awaiting confirmations until we consider it spendable.

Fields

§channel_id: ChannelId

The identifier of the channel this balance belongs to.

§counterparty_node_id: PublicKey

The identifier of our channel counterparty.

§amount_satoshis: u64

The amount available to claim, in satoshis, possibly excluding the on-chain fees which were spent in broadcasting the transaction.

§confirmation_height: u32

The height at which an Event::SpendableOutputs event will be generated for this amount.

§source: BalanceSource

Whether this balance is a result of cooperative close, a force-close, or an HTLC.

§

ContentiousClaimable

The channel has been closed, and the given balance should be ours but awaiting spending transaction confirmation. If the spending transaction does not confirm in time, it is possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.

Once the spending transaction confirms, before it has reached enough confirmations to be considered safe from chain reorganizations, the balance will instead be provided via LightningBalance::ClaimableAwaitingConfirmations.

Fields

§channel_id: ChannelId

The identifier of the channel this balance belongs to.

§counterparty_node_id: PublicKey

The identifier of our channel counterparty.

§amount_satoshis: u64

The amount available to claim, in satoshis, excluding the on-chain fees which will be required to do so.

§timeout_height: u32

The height at which the counterparty may be able to claim the balance if we have not done so.

§payment_hash: PaymentHash

The payment hash that locks this HTLC.

§payment_preimage: PaymentPreimage

The preimage that can be used to claim this HTLC.

§

MaybeTimeoutClaimableHTLC

HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat likely to be claimed by our counterparty before we do.

Fields

§channel_id: ChannelId

The identifier of the channel this balance belongs to.

§counterparty_node_id: PublicKey

The identifier of our channel counterparty.

§amount_satoshis: u64

The amount potentially available to claim, in satoshis, excluding the on-chain fees which will be required to do so.

§claimable_height: u32

The height at which we will be able to claim the balance if our counterparty has not done so.

§payment_hash: PaymentHash

The payment hash whose preimage our counterparty needs to claim this HTLC.

§outbound_payment: bool

Indicates whether this HTLC represents a payment which was sent outbound from us.

§

MaybePreimageClaimableHTLC

HTLCs which we received from our counterparty which are claimable with a preimage which we do not currently have. This will only be claimable if we receive the preimage from the node to which we forwarded this HTLC before the timeout.

Fields

§channel_id: ChannelId

The identifier of the channel this balance belongs to.

§counterparty_node_id: PublicKey

The identifier of our channel counterparty.

§amount_satoshis: u64

The amount potentially available to claim, in satoshis, excluding the on-chain fees which will be required to do so.

§expiry_height: u32

The height at which our counterparty will be able to claim the balance if we have not yet received the preimage and claimed it ourselves.

§payment_hash: PaymentHash

The payment hash whose preimage we need to claim this HTLC.

§

CounterpartyRevokedOutputClaimable

The channel has been closed, and our counterparty broadcasted a revoked commitment transaction.

Thus, we’re able to claim all outputs in the commitment transaction, one of which has the following amount.

Fields

§channel_id: ChannelId

The identifier of the channel this balance belongs to.

§counterparty_node_id: PublicKey

The identifier of our channel counterparty.

§amount_satoshis: u64

The amount, in satoshis, of the output which we can claim.

Trait Implementations§

Source§

impl Clone for LightningBalance

Source§

fn clone(&self) -> LightningBalance

Returns a duplicate 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 Debug for LightningBalance

Source§

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

Formats the value using the given formatter. Read more

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
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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,