@@ -783,6 +783,9 @@ pub struct ChannelManager<M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: D
783783 /// See `ChannelManager` struct-level documentation for lock order requirements.
784784 pending_outbound_payments : Mutex < HashMap < PaymentId , PendingOutboundPayment > > ,
785785
786+ /// HTLCs that may be retried using the given `RouteParameters`.
787+ retryable_htlcs : Mutex < Vec < ( PaymentId , RouteParameters ) > > ,
788+
786789 /// SCID/SCID Alias -> forward infos. Key of 0 means payments received.
787790 ///
788791 /// Note that because we may have an SCID Alias as the key we can have two entries per channel,
@@ -1614,6 +1617,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref> ChannelManager<
16141617 outbound_scid_aliases : Mutex :: new ( HashSet :: new ( ) ) ,
16151618 pending_inbound_payments : Mutex :: new ( HashMap :: new ( ) ) ,
16161619 pending_outbound_payments : Mutex :: new ( HashMap :: new ( ) ) ,
1620+ retryable_htlcs : Mutex :: new ( Vec :: new ( ) ) ,
16171621 forward_htlcs : Mutex :: new ( HashMap :: new ( ) ) ,
16181622 claimable_payments : Mutex :: new ( ClaimablePayments { claimable_htlcs : HashMap :: new ( ) , pending_claiming_payments : HashMap :: new ( ) } ) ,
16191623 pending_intercepted_htlcs : Mutex :: new ( HashMap :: new ( ) ) ,
@@ -7137,12 +7141,19 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref> Writeable for C
71377141 debug_assert ! ( false , "While we have code to serialize pending_claiming_payments, the map should always be empty until a later PR" ) ;
71387142 }
71397143
7144+ let mut retryable_htlcs = None ;
7145+ let our_retryable_htlcs = self . retryable_htlcs . lock ( ) . unwrap ( ) ;
7146+ if our_retryable_htlcs. len ( ) != 0 {
7147+ retryable_htlcs = Some ( our_retryable_htlcs) ;
7148+ }
7149+
71407150 write_tlv_fields ! ( writer, {
71417151 ( 1 , pending_outbound_payments_no_retry, required) ,
71427152 ( 2 , pending_intercepted_htlcs, option) ,
71437153 ( 3 , pending_outbound_payments, required) ,
71447154 ( 4 , pending_claiming_payments, option) ,
71457155 ( 5 , self . our_network_pubkey, required) ,
7156+ ( 6 , retryable_htlcs, option) ,
71467157 ( 7 , self . fake_scid_rand_bytes, required) ,
71477158 ( 9 , htlc_purposes, vec_type) ,
71487159 ( 11 , self . probing_cookie_secret, required) ,
@@ -7473,6 +7484,7 @@ impl<'a, M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref>
74737484 let mut pending_outbound_payments_no_retry: Option < HashMap < PaymentId , HashSet < [ u8 ; 32 ] > > > = None ;
74747485 let mut pending_outbound_payments = None ;
74757486 let mut pending_intercepted_htlcs: Option < HashMap < InterceptId , PendingAddHTLCInfo > > = Some ( HashMap :: new ( ) ) ;
7487+ let mut retryable_htlcs: Option < Vec < ( PaymentId , RouteParameters ) > > = Some ( Vec :: new ( ) ) ;
74767488 let mut received_network_pubkey: Option < PublicKey > = None ;
74777489 let mut fake_scid_rand_bytes: Option < [ u8 ; 32 ] > = None ;
74787490 let mut probing_cookie_secret: Option < [ u8 ; 32 ] > = None ;
@@ -7484,6 +7496,7 @@ impl<'a, M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref>
74847496 ( 3 , pending_outbound_payments, option) ,
74857497 ( 4 , pending_claiming_payments, option) ,
74867498 ( 5 , received_network_pubkey, option) ,
7499+ ( 6 , retryable_htlcs, option) ,
74877500 ( 7 , fake_scid_rand_bytes, option) ,
74887501 ( 9 , claimable_htlc_purposes, vec_type) ,
74897502 ( 11 , probing_cookie_secret, option) ,
@@ -7754,6 +7767,7 @@ impl<'a, M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref>
77547767 pending_inbound_payments : Mutex :: new ( pending_inbound_payments) ,
77557768 pending_outbound_payments : Mutex :: new ( pending_outbound_payments. unwrap ( ) ) ,
77567769 pending_intercepted_htlcs : Mutex :: new ( pending_intercepted_htlcs. unwrap ( ) ) ,
7770+ retryable_htlcs : Mutex :: new ( retryable_htlcs. unwrap ( ) ) ,
77577771
77587772 forward_htlcs : Mutex :: new ( forward_htlcs) ,
77597773 claimable_payments : Mutex :: new ( ClaimablePayments { claimable_htlcs, pending_claiming_payments : pending_claiming_payments. unwrap ( ) } ) ,
0 commit comments