X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Foutbound_payment.rs;h=a13a618d83c4c2b0e8988f6103a1a26c2fcb2d63;hb=eec5ec6b50720144fc23503c3ee9c1c8850517ac;hp=f363a6d60ffa7b877057c5c19b568aecd6a419d7;hpb=9ede794e8e8559f1b2b386c1c57372094fc92fd4;p=rust-lightning diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index f363a6d6..a13a618d 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -13,7 +13,7 @@ use bitcoin::hashes::Hash; use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::secp256k1::{self, Secp256k1, SecretKey}; -use crate::chain::keysinterface::{EntropySource, NodeSigner, Recipient}; +use crate::sign::{EntropySource, NodeSigner, Recipient}; use crate::events::{self, PaymentFailureReason}; use crate::ln::{PaymentHash, PaymentPreimage, PaymentSecret}; use crate::ln::channelmanager::{ChannelDetails, EventCompletionAction, HTLCSource, IDEMPOTENCY_TIMEOUT_TICKS, PaymentId}; @@ -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, timer_ticks_without_htlcs: u8, }, @@ -311,7 +312,7 @@ impl Display for PaymentAttemptsUsingTime { /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment /// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed /// [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum RetryableSendFailure { /// The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note /// that this error is *not* caused by [`Retry::Timeout`]. @@ -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)); }