@@ -6670,6 +6670,13 @@ impl_writeable_tlv_based!(PendingInboundPayment, {
66706670 ( 8 , min_value_msat, required) ,
66716671} ) ;
66726672
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+
66736680impl_writeable_tlv_based_enum_upgradable ! ( PendingOutboundPayment ,
66746681 ( 0 , Legacy ) => {
66756682 ( 0 , session_privs, required) ,
@@ -6756,6 +6763,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable f
67566763
67576764 let pending_inbound_payments = self . pending_inbound_payments . lock ( ) . unwrap ( ) ;
67586765 let pending_outbound_payments = self . pending_outbound_payments . lock ( ) . unwrap ( ) ;
6766+ let pending_intercepted_payments = self . pending_intercepted_payments . lock ( ) . unwrap ( ) ;
6767+
67596768 let events = self . pending_events . lock ( ) . unwrap ( ) ;
67606769 ( events. len ( ) as u64 ) . write ( writer) ?;
67616770 for event in events. iter ( ) {
@@ -6824,6 +6833,12 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> Writeable f
68246833 ( 11 , self . probing_cookie_secret, required) ,
68256834 } ) ;
68266835
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+
68276842 Ok ( ( ) )
68286843 }
68296844}
@@ -7120,14 +7135,23 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
71207135 let mut fake_scid_rand_bytes: Option < [ u8 ; 32 ] > = None ;
71217136 let mut probing_cookie_secret: Option < [ u8 ; 32 ] > = None ;
71227137 let mut claimable_htlc_purposes = None ;
7123- read_tlv_fields ! ( reader, {
7138+ read_tlv_fields ! ( reader. by_ref ( ) , {
71247139 ( 1 , pending_outbound_payments_no_retry, option) ,
71257140 ( 3 , pending_outbound_payments, option) ,
71267141 ( 5 , received_network_pubkey, option) ,
71277142 ( 7 , fake_scid_rand_bytes, option) ,
71287143 ( 9 , claimable_htlc_purposes, vec_type) ,
71297144 ( 11 , probing_cookie_secret, option) ,
71307145 } ) ;
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+
71317155 if fake_scid_rand_bytes. is_none ( ) {
71327156 fake_scid_rand_bytes = Some ( args. keys_manager . get_secure_random_bytes ( ) ) ;
71337157 }
@@ -7337,7 +7361,7 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
73377361 inbound_payment_key : expanded_inbound_key,
73387362 pending_inbound_payments : Mutex :: new ( pending_inbound_payments) ,
73397363 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 ) ,
73417365
73427366 outbound_scid_aliases : Mutex :: new ( outbound_scid_aliases) ,
73437367 fake_scid_rand_bytes : fake_scid_rand_bytes. unwrap ( ) ,
0 commit comments