@@ -6670,6 +6670,13 @@ impl_writeable_tlv_based!(PendingInboundPayment, {
6670
6670
( 8 , min_value_msat, required) ,
6671
6671
} ) ;
6672
6672
6673
+ impl_writeable_tlv_based ! ( PendingInterceptedHTLC , {
6674
+ ( 0 , forward_info, required) ,
6675
+ ( 2 , prev_short_channel_id, required) ,
6676
+ ( 4 , prev_htlc_id, required) ,
6677
+ ( 6 , prev_funding_outpoint, required)
6678
+ } ) ;
6679
+
6673
6680
impl_writeable_tlv_based_enum_upgradable ! ( PendingOutboundPayment ,
6674
6681
( 0 , Legacy ) => {
6675
6682
( 0 , session_privs, required) ,
@@ -6756,6 +6763,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable f
6756
6763
6757
6764
let pending_inbound_payments = self . pending_inbound_payments . lock ( ) . unwrap ( ) ;
6758
6765
let pending_outbound_payments = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
6766
+ let pending_intercepted_payments = self . pending_intercepted_payments . lock ( ) . unwrap ( ) ;
6767
+
6759
6768
let events = self . pending_events . lock ( ) . unwrap ( ) ;
6760
6769
( events. len ( ) as u64 ) . write ( writer) ?;
6761
6770
for event in events. iter ( ) {
@@ -6824,6 +6833,12 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable f
6824
6833
( 11 , self . probing_cookie_secret, required) ,
6825
6834
} ) ;
6826
6835
6836
+ ( pending_intercepted_payments. len ( ) as u64 ) . write ( writer) ?;
6837
+ for ( intercept_id, pending_intercepted_payment) in pending_intercepted_payments. iter ( ) {
6838
+ intercept_id. write ( writer) ?;
6839
+ pending_intercepted_payment. write ( writer) ?;
6840
+ }
6841
+
6827
6842
Ok ( ( ) )
6828
6843
}
6829
6844
}
@@ -7120,14 +7135,23 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
7120
7135
let mut fake_scid_rand_bytes: Option < [ u8 ; 32 ] > = None ;
7121
7136
let mut probing_cookie_secret: Option < [ u8 ; 32 ] > = None ;
7122
7137
let mut claimable_htlc_purposes = None ;
7123
- read_tlv_fields ! ( reader, {
7138
+ read_tlv_fields ! ( reader. by_ref ( ) , {
7124
7139
( 1 , pending_outbound_payments_no_retry, option) ,
7125
7140
( 3 , pending_outbound_payments, option) ,
7126
7141
( 5 , received_network_pubkey, option) ,
7127
7142
( 7 , fake_scid_rand_bytes, option) ,
7128
7143
( 9 , claimable_htlc_purposes, vec_type) ,
7129
7144
( 11 , probing_cookie_secret, option) ,
7130
7145
} ) ;
7146
+
7147
+ let pending_intercepted_payment_count: u64 = Readable :: read ( reader) ?;
7148
+ let mut pending_intercepted_payments: HashMap < InterceptId , PendingInterceptedHTLC > = HashMap :: with_capacity ( cmp:: min ( pending_intercepted_payment_count as usize , MAX_ALLOC_SIZE /( 3 * 32 ) ) ) ;
7149
+ for _ in 0 ..pending_intercepted_payment_count {
7150
+ if pending_intercepted_payments. insert ( Readable :: read ( reader) ?, Readable :: read ( reader) ?) . is_some ( ) {
7151
+ return Err ( DecodeError :: InvalidValue ) ;
7152
+ }
7153
+ }
7154
+
7131
7155
if fake_scid_rand_bytes. is_none ( ) {
7132
7156
fake_scid_rand_bytes = Some ( args. keys_manager . get_secure_random_bytes ( ) ) ;
7133
7157
}
@@ -7337,7 +7361,7 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
7337
7361
inbound_payment_key : expanded_inbound_key,
7338
7362
pending_inbound_payments : Mutex :: new ( pending_inbound_payments) ,
7339
7363
pending_outbound_payments : Mutex :: new ( pending_outbound_payments. unwrap ( ) ) ,
7340
- pending_intercepted_payments : Mutex :: new ( HashMap :: new ( ) ) ,
7364
+ pending_intercepted_payments : Mutex :: new ( pending_intercepted_payments ) ,
7341
7365
7342
7366
outbound_scid_aliases : Mutex :: new ( outbound_scid_aliases) ,
7343
7367
fake_scid_rand_bytes : fake_scid_rand_bytes. unwrap ( ) ,
0 commit comments