Enum Event

Source
pub enum Event {
    PaymentSuccessful {
        payment_id: Option<PaymentId>,
        payment_hash: PaymentHash,
        payment_preimage: Option<PaymentPreimage>,
        fee_paid_msat: Option<u64>,
    },
    PaymentFailed {
        payment_id: Option<PaymentId>,
        payment_hash: Option<PaymentHash>,
        reason: Option<PaymentFailureReason>,
    },
    PaymentReceived {
        payment_id: Option<PaymentId>,
        payment_hash: PaymentHash,
        amount_msat: u64,
        custom_records: Vec<CustomTlvRecord>,
    },
    PaymentForwarded {
        prev_channel_id: ChannelId,
        next_channel_id: ChannelId,
        prev_user_channel_id: Option<UserChannelId>,
        next_user_channel_id: Option<UserChannelId>,
        prev_node_id: Option<PublicKey>,
        next_node_id: Option<PublicKey>,
        total_fee_earned_msat: Option<u64>,
        skimmed_fee_msat: Option<u64>,
        claim_from_onchain_tx: bool,
        outbound_amount_forwarded_msat: Option<u64>,
    },
    PaymentClaimable {
        payment_id: PaymentId,
        payment_hash: PaymentHash,
        claimable_amount_msat: u64,
        claim_deadline: Option<u32>,
        custom_records: Vec<CustomTlvRecord>,
    },
    ChannelPending {
        channel_id: ChannelId,
        user_channel_id: UserChannelId,
        former_temporary_channel_id: ChannelId,
        counterparty_node_id: PublicKey,
        funding_txo: OutPoint,
    },
    ChannelReady {
        channel_id: ChannelId,
        user_channel_id: UserChannelId,
        counterparty_node_id: Option<PublicKey>,
    },
    ChannelClosed {
        channel_id: ChannelId,
        user_channel_id: UserChannelId,
        counterparty_node_id: Option<PublicKey>,
        reason: Option<ClosureReason>,
    },
}
Expand description

An event emitted by Node, which should be handled by the user.

Variants§

§

PaymentSuccessful

A sent payment was successful.

Fields

§payment_id: Option<PaymentId>

A local identifier used to track the payment.

Will only be None for events serialized with LDK Node v0.2.1 or prior.

§payment_hash: PaymentHash

The hash of the payment.

§payment_preimage: Option<PaymentPreimage>

The preimage to the payment_hash.

Note that this serves as a payment receipt.

Will only be None for events serialized with LDK Node v0.4.2 or prior.

§fee_paid_msat: Option<u64>

The total fee which was spent at intermediate hops in this payment.

§

PaymentFailed

A sent payment has failed.

Fields

§payment_id: Option<PaymentId>

A local identifier used to track the payment.

Will only be None for events serialized with LDK Node v0.2.1 or prior.

§payment_hash: Option<PaymentHash>

The hash of the payment.

This will be None if the payment failed before receiving an invoice when paying a BOLT12 Offer.

§reason: Option<PaymentFailureReason>

The reason why the payment failed.

This will be None for events serialized by LDK Node v0.2.1 and prior.

§

PaymentReceived

A payment has been received.

Fields

§payment_id: Option<PaymentId>

A local identifier used to track the payment.

Will only be None for events serialized with LDK Node v0.2.1 or prior.

§payment_hash: PaymentHash

The hash of the payment.

§amount_msat: u64

The value, in thousandths of a satoshi, that has been received.

§custom_records: Vec<CustomTlvRecord>

Custom TLV records received on the payment

§

PaymentForwarded

A payment has been forwarded.

Fields

§prev_channel_id: ChannelId

The channel id of the incoming channel between the previous node and us.

§next_channel_id: ChannelId

The channel id of the outgoing channel between the next node and us.

§prev_user_channel_id: Option<UserChannelId>

The user_channel_id of the incoming channel between the previous node and us.

Will only be None for events serialized with LDK Node v0.3.0 or prior.

§next_user_channel_id: Option<UserChannelId>

The user_channel_id of the outgoing channel between the next node and us.

This will be None if the payment was settled via an on-chain transaction. See the caveat described for the total_fee_earned_msat field.

§prev_node_id: Option<PublicKey>

The node id of the previous node.

This is only None for HTLCs received prior to LDK Node v0.5 or for events serialized by versions prior to v0.5.

§next_node_id: Option<PublicKey>

The node id of the next node.

This is only None for HTLCs received prior to LDK Node v0.5 or for events serialized by versions prior to v0.5.

§total_fee_earned_msat: Option<u64>

The total fee, in milli-satoshis, which was earned as a result of the payment.

Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC was pending, the amount the next hop claimed will have been rounded down to the nearest whole satoshi. Thus, the fee calculated here may be higher than expected as we still claimed the full value in millisatoshis from the source. In this case, claim_from_onchain_tx will be set.

If the channel which sent us the payment has been force-closed, we will claim the funds via an on-chain transaction. In that case we do not yet know the on-chain transaction fees which we will spend and will instead set this to None.

§skimmed_fee_msat: Option<u64>

The share of the total fee, in milli-satoshis, which was withheld in addition to the forwarding fee.

This will only be Some if we forwarded an intercepted HTLC with less than the expected amount. This means our counterparty accepted to receive less than the invoice amount.

The caveat described above the total_fee_earned_msat field applies here as well.

§claim_from_onchain_tx: bool

If this is true, the forwarded HTLC was claimed by our counterparty via an on-chain transaction.

§outbound_amount_forwarded_msat: Option<u64>

The final amount forwarded, in milli-satoshis, after the fee is deducted.

The caveat described above the total_fee_earned_msat field applies here as well.

§

PaymentClaimable

A payment for a previously-registered payment hash has been received.

This needs to be manually claimed by supplying the correct preimage to claim_for_hash.

If the the provided parameters don’t match the expectations or the preimage can’t be retrieved in time, should be failed-back via fail_for_hash.

Note claiming will necessarily fail after the claim_deadline has been reached.

Fields

§payment_id: PaymentId

A local identifier used to track the payment.

§payment_hash: PaymentHash

The hash of the payment.

§claimable_amount_msat: u64

The value, in thousandths of a satoshi, that is claimable.

§claim_deadline: Option<u32>

The block height at which this payment will be failed back and will no longer be eligible for claiming.

§custom_records: Vec<CustomTlvRecord>

Custom TLV records attached to the payment

§

ChannelPending

A channel has been created and is pending confirmation on-chain.

Fields

§channel_id: ChannelId

The channel_id of the channel.

§user_channel_id: UserChannelId

The user_channel_id of the channel.

§former_temporary_channel_id: ChannelId

The temporary_channel_id this channel used to be known by during channel establishment.

§counterparty_node_id: PublicKey

The node_id of the channel counterparty.

§funding_txo: OutPoint

The outpoint of the channel’s funding transaction.

§

ChannelReady

A channel is ready to be used.

Fields

§channel_id: ChannelId

The channel_id of the channel.

§user_channel_id: UserChannelId

The user_channel_id of the channel.

§counterparty_node_id: Option<PublicKey>

The node_id of the channel counterparty.

This will be None for events serialized by LDK Node v0.1.0 and prior.

§

ChannelClosed

A channel has been closed.

Fields

§channel_id: ChannelId

The channel_id of the channel.

§user_channel_id: UserChannelId

The user_channel_id of the channel.

§counterparty_node_id: Option<PublicKey>

The node_id of the channel counterparty.

This will be None for events serialized by LDK Node v0.1.0 and prior.

§reason: Option<ClosureReason>

This will be None for events serialized by LDK Node v0.2.1 and prior.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

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 Event

Source§

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

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

impl PartialEq for Event

Source§

fn eq(&self, other: &Event) -> 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 Readable for Event

Source§

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

Reads a Self in from the given Read.
Source§

impl Writeable for Event

Source§

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

Writes self out to the given Writer.
Source§

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

Writes self out to a Vec<u8>.
Source§

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

impl Eq for Event

Source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnwindSafe for Event

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

Source§

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

Checks if this value is equivalent to the given key. 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

Checks if this value is equivalent to the given key. 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.
Source§

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

Source§

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

Checks if this value is equivalent to the given key. 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> MaybeReadable for T
where T: Readable,

Source§

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

Reads a Self in from the given Read.
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,