From: Valentine Wallace Date: Tue, 20 Dec 2022 23:18:17 +0000 (-0500) Subject: Make add_new_pending_payment private to module X-Git-Tag: v0.0.114-beta~77^2~2 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=8d5f7c87cb818784ced06ee73b022f28d432f777;p=rust-lightning Make add_new_pending_payment private to module And expose it in testing only, for safety --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 026f5a32b..f31ec7f07 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -2386,7 +2386,7 @@ impl ChannelManager, payment_id: PaymentId, route: &Route) -> Result, PaymentSendFailure> { let best_block_height = self.best_block.read().unwrap().height(); - self.pending_outbound_payments.add_new_pending_payment(payment_hash, payment_secret, payment_id, route, &self.keys_manager, best_block_height) + self.pending_outbound_payments.test_add_new_pending_payment(payment_hash, payment_secret, payment_id, route, &self.keys_manager, best_block_height) } diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index e66f0bc25..08aeae5c5 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -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 {