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.
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.
custom_records: Vec<CustomTlvRecord>
Custom TLV records received on the payment
PaymentForwarded
A payment has been forwarded.
Fields
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.
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_hash: PaymentHash
The hash of the payment.
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
user_channel_id: UserChannelId
The user_channel_id
of the channel.
ChannelReady
A channel is ready to be used.
Fields
user_channel_id: UserChannelId
The user_channel_id
of the channel.
ChannelClosed
A channel has been closed.
Fields
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 Writeable for Event
impl Writeable for Event
impl Eq for Event
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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