mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 15:02:20 +01:00
Document when PaymentPathSuccessful::payment_hash
is filled in.
The `payment_hash` field in `PaymentPathSuccessful` is always `Some` as long as the pening payment tracker has a `payment_hash`, which is true for all `Pending` payments as well as all `Fulfilled` payments starting with the commit which added `PaymentPathSuccessful` - 3b5c370b404e2f5a8f3c35093b97406f149a9340c177c05252574083d68df0da.
This commit is contained in:
parent
e94647ca4e
commit
e1394f3ea0
2 changed files with 6 additions and 1 deletions
|
@ -498,6 +498,8 @@ pub enum Event {
|
|||
payment_id: PaymentId,
|
||||
/// The hash that was given to [`ChannelManager::send_payment`].
|
||||
///
|
||||
/// This will be `Some` for all payments which completed on LDK 0.0.104 or later.
|
||||
///
|
||||
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
|
||||
payment_hash: Option<PaymentHash>,
|
||||
/// The payment path that was successful.
|
||||
|
|
|
@ -60,6 +60,7 @@ pub(crate) enum PendingOutboundPayment {
|
|||
/// and add a pending payment that was already fulfilled.
|
||||
Fulfilled {
|
||||
session_privs: HashSet<[u8; 32]>,
|
||||
/// Filled in for any payment which moved to `Fulfilled` on LDK 0.0.104 or later.
|
||||
payment_hash: Option<PaymentHash>,
|
||||
timer_ticks_without_htlcs: u8,
|
||||
},
|
||||
|
@ -1168,9 +1169,11 @@ impl OutboundPayments {
|
|||
if let hash_map::Entry::Occupied(mut payment) = outbounds.entry(payment_id) {
|
||||
assert!(payment.get().is_fulfilled());
|
||||
if payment.get_mut().remove(&session_priv_bytes, None) {
|
||||
let payment_hash = payment.get().payment_hash();
|
||||
debug_assert!(payment_hash.is_some());
|
||||
pending_events.push_back((events::Event::PaymentPathSuccessful {
|
||||
payment_id,
|
||||
payment_hash: payment.get().payment_hash(),
|
||||
payment_hash,
|
||||
path,
|
||||
}, None));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue