]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Make add_new_pending_payment private to module
authorValentine Wallace <vwallace@protonmail.com>
Tue, 20 Dec 2022 23:18:17 +0000 (18:18 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 21 Dec 2022 02:23:54 +0000 (21:23 -0500)
And expose it in testing only, for safety

lightning/src/ln/channelmanager.rs
lightning/src/ln/outbound_payment.rs

index 026f5a32bca41c6cc5759de7af60dec8b431f15a..f31ec7f07a44b57e0954d5a490f3e596f4f059a3 100644 (file)
@@ -2386,7 +2386,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
        #[cfg(test)]
        pub(crate) fn test_add_new_pending_payment(&self, payment_hash: PaymentHash, payment_secret: Option<PaymentSecret>, payment_id: PaymentId, route: &Route) -> Result<Vec<[u8; 32]>, 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)
        }
 
 
index e66f0bc25b99beaa3f36e6ac07b65e2007a69ea5..08aeae5c58bce3bc9e1c355482f9b01d370da98f 100644 (file)
@@ -403,7 +403,15 @@ impl OutboundPayments {
                }
        }
 
-       pub(super) fn add_new_pending_payment<K: Deref>(
+       #[cfg(test)]
+       pub(super) fn test_add_new_pending_payment<K: Deref>(
+               &self, payment_hash: PaymentHash, payment_secret: Option<PaymentSecret>, payment_id: PaymentId,
+               route: &Route, keys_manager: &K, best_block_height: u32
+       ) -> Result<Vec<[u8; 32]>, 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<K: Deref>(
                &self, payment_hash: PaymentHash, payment_secret: Option<PaymentSecret>, payment_id: PaymentId,
                route: &Route, keys_manager: &K, best_block_height: u32
        ) -> Result<Vec<[u8; 32]>, PaymentSendFailure> where K::Target: KeysInterface {