From 8d5f7c87cb818784ced06ee73b022f28d432f777 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Tue, 20 Dec 2022 18:18:17 -0500 Subject: [PATCH] Make add_new_pending_payment private to module And expose it in testing only, for safety --- lightning/src/ln/channelmanager.rs | 2 +- lightning/src/ln/outbound_payment.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) 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 { -- 2.39.5