X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Foutbound_payment.rs;h=6da14388ad8ae2c7b65a7244a8e324422ede393e;hb=60492d769a31e72fe9c6bc40701b132f94633c60;hp=95ad59e634faf41bf461855255b10ec5574cdcb8;hpb=e64ebe8608a3efdf630b288a7bddddf916f0cf86;p=rust-lightning diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index 95ad59e6..6da14388 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::{KeysInterface, Recipient}; +use crate::chain::keysinterface::{EntropySource, KeysInterface, NodeSigner, Recipient}; use crate::ln::{PaymentHash, PaymentPreimage, PaymentSecret}; use crate::ln::channelmanager::{HTLCSource, IDEMPOTENCY_TIMEOUT_TICKS, PaymentId}; use crate::ln::msgs::DecodeError; @@ -403,7 +403,15 @@ impl OutboundPayments { } } - pub(super) fn add_new_pending_payment( + #[cfg(test)] + pub(super) fn test_add_new_pending_payment( + &self, payment_hash: PaymentHash, payment_secret: Option, payment_id: PaymentId, + route: &Route, keys_manager: &K, best_block_height: u32 + ) -> Result, PaymentSendFailure> where K::Target: KeysInterface { + self.add_new_pending_payment(payment_hash, payment_secret, payment_id, route, keys_manager, best_block_height) + } + + fn add_new_pending_payment( &self, payment_hash: PaymentHash, payment_secret: Option, payment_id: PaymentId, route: &Route, keys_manager: &K, best_block_height: u32 ) -> Result, PaymentSendFailure> where K::Target: KeysInterface { @@ -712,9 +720,9 @@ impl OutboundPayments { log_trace!(logger, "Failing outbound payment HTLC with payment_hash {}", log_bytes!(payment_hash.0)); let path_failure = { - #[cfg(test)] + #[cfg(test)] let (network_update, short_channel_id, payment_retryable, onion_error_code, onion_error_data) = onion_error.decode_onion_failure(secp_ctx, logger, &source); - #[cfg(not(test))] + #[cfg(not(test))] let (network_update, short_channel_id, payment_retryable, _, _) = onion_error.decode_onion_failure(secp_ctx, logger, &source); if payment_is_probe(payment_hash, &payment_id, probing_cookie_secret) {