@@ -557,9 +557,6 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
557
557
/// See `PendingOutboundPayment` documentation for more info.
558
558
///
559
559
/// Locked *after* channel_state.
560
- #[ cfg( test) ] // Exposed so that we can check there aren't dangling entries
561
- pub ( crate ) pending_outbound_payments : Mutex < HashMap < PaymentId , PendingOutboundPayment > > ,
562
- #[ cfg( not( test) ) ]
563
560
pending_outbound_payments : Mutex < HashMap < PaymentId , PendingOutboundPayment > > ,
564
561
565
562
our_network_key : SecretKey ,
@@ -1971,15 +1968,14 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
1971
1968
if !chan. get ( ) . is_live ( ) {
1972
1969
return Err ( APIError :: ChannelUnavailable { err : "Peer for first hop currently disconnected/pending monitor update!" . to_owned ( ) } ) ;
1973
1970
}
1974
- let send_res =
1975
- break_chan_entry ! ( self , chan. get_mut( ) . send_htlc_and_commit(
1976
- htlc_msat, payment_hash. clone( ) , htlc_cltv, HTLCSource :: OutboundRoute {
1977
- path: path. clone( ) ,
1978
- session_priv: session_priv. clone( ) ,
1979
- first_hop_htlc_msat: htlc_msat,
1980
- payment_id,
1981
- } , onion_packet, & self . logger) ,
1982
- channel_state, chan) ;
1971
+ let send_res = break_chan_entry ! ( self , chan. get_mut( ) . send_htlc_and_commit(
1972
+ htlc_msat, payment_hash. clone( ) , htlc_cltv, HTLCSource :: OutboundRoute {
1973
+ path: path. clone( ) ,
1974
+ session_priv: session_priv. clone( ) ,
1975
+ first_hop_htlc_msat: htlc_msat,
1976
+ payment_id,
1977
+ } , onion_packet, & self . logger) ,
1978
+ channel_state, chan) ;
1983
1979
1984
1980
let mut pending_outbounds = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
1985
1981
let payment = pending_outbounds. entry ( payment_id) . or_insert_with ( || PendingOutboundPayment :: Retryable {
@@ -4392,6 +4388,11 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
4392
4388
self . process_pending_events ( & event_handler) ;
4393
4389
events. into_inner ( )
4394
4390
}
4391
+
4392
+ #[ cfg( test) ]
4393
+ pub fn has_pending_payments ( & self ) -> bool {
4394
+ !self . pending_outbound_payments . lock ( ) . unwrap ( ) . is_empty ( )
4395
+ }
4395
4396
}
4396
4397
4397
4398
impl < Signer : Sign , M : Deref , T : Deref , K : Deref , F : Deref , L : Deref > MessageSendEventsProvider for ChannelManager < Signer , M , T , K , F , L >
0 commit comments