@@ -783,6 +783,9 @@ pub struct ChannelManager<M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: D
783
783
/// See `ChannelManager` struct-level documentation for lock order requirements.
784
784
pending_outbound_payments : Mutex < HashMap < PaymentId , PendingOutboundPayment > > ,
785
785
786
+ /// HTLCs that may be retried using the given `RouteParameters`.
787
+ retryable_htlcs : Mutex < Vec < ( PaymentId , RouteParameters ) > > ,
788
+
786
789
/// SCID/SCID Alias -> forward infos. Key of 0 means payments received.
787
790
///
788
791
/// 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<
1614
1617
outbound_scid_aliases : Mutex :: new ( HashSet :: new ( ) ) ,
1615
1618
pending_inbound_payments : Mutex :: new ( HashMap :: new ( ) ) ,
1616
1619
pending_outbound_payments : Mutex :: new ( HashMap :: new ( ) ) ,
1620
+ retryable_htlcs : Mutex :: new ( Vec :: new ( ) ) ,
1617
1621
forward_htlcs : Mutex :: new ( HashMap :: new ( ) ) ,
1618
1622
claimable_payments : Mutex :: new ( ClaimablePayments { claimable_htlcs : HashMap :: new ( ) , pending_claiming_payments : HashMap :: new ( ) } ) ,
1619
1623
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
7137
7141
debug_assert ! ( false , "While we have code to serialize pending_claiming_payments, the map should always be empty until a later PR" ) ;
7138
7142
}
7139
7143
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
+
7140
7150
write_tlv_fields ! ( writer, {
7141
7151
( 1 , pending_outbound_payments_no_retry, required) ,
7142
7152
( 2 , pending_intercepted_htlcs, option) ,
7143
7153
( 3 , pending_outbound_payments, required) ,
7144
7154
( 4 , pending_claiming_payments, option) ,
7145
7155
( 5 , self . our_network_pubkey, required) ,
7156
+ ( 6 , retryable_htlcs, option) ,
7146
7157
( 7 , self . fake_scid_rand_bytes, required) ,
7147
7158
( 9 , htlc_purposes, vec_type) ,
7148
7159
( 11 , self . probing_cookie_secret, required) ,
@@ -7473,6 +7484,7 @@ impl<'a, M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref>
7473
7484
let mut pending_outbound_payments_no_retry: Option < HashMap < PaymentId , HashSet < [ u8 ; 32 ] > > > = None ;
7474
7485
let mut pending_outbound_payments = None ;
7475
7486
let mut pending_intercepted_htlcs: Option < HashMap < InterceptId , PendingAddHTLCInfo > > = Some ( HashMap :: new ( ) ) ;
7487
+ let mut retryable_htlcs: Option < Vec < ( PaymentId , RouteParameters ) > > = Some ( Vec :: new ( ) ) ;
7476
7488
let mut received_network_pubkey: Option < PublicKey > = None ;
7477
7489
let mut fake_scid_rand_bytes: Option < [ u8 ; 32 ] > = None ;
7478
7490
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>
7484
7496
( 3 , pending_outbound_payments, option) ,
7485
7497
( 4 , pending_claiming_payments, option) ,
7486
7498
( 5 , received_network_pubkey, option) ,
7499
+ ( 6 , retryable_htlcs, option) ,
7487
7500
( 7 , fake_scid_rand_bytes, option) ,
7488
7501
( 9 , claimable_htlc_purposes, vec_type) ,
7489
7502
( 11 , probing_cookie_secret, option) ,
@@ -7754,6 +7767,7 @@ impl<'a, M: Deref, T: Deref, K: Deref, F: Deref, R: Deref, L: Deref>
7754
7767
pending_inbound_payments : Mutex :: new ( pending_inbound_payments) ,
7755
7768
pending_outbound_payments : Mutex :: new ( pending_outbound_payments. unwrap ( ) ) ,
7756
7769
pending_intercepted_htlcs : Mutex :: new ( pending_intercepted_htlcs. unwrap ( ) ) ,
7770
+ retryable_htlcs : Mutex :: new ( retryable_htlcs. unwrap ( ) ) ,
7757
7771
7758
7772
forward_htlcs : Mutex :: new ( forward_htlcs) ,
7759
7773
claimable_payments : Mutex :: new ( ClaimablePayments { claimable_htlcs, pending_claiming_payments : pending_claiming_payments. unwrap ( ) } ) ,
0 commit comments