@@ -213,6 +213,8 @@ struct ClaimableHTLC {
213
213
total_value_received : Option < u64 > ,
214
214
/// The sender intended sum total of all MPP parts specified in the onion
215
215
total_msat : u64 ,
216
+ /// The extra fee our counterparty skimmed off the top of this HTLC.
217
+ counterparty_skimmed_fee_msat : Option < u64 > ,
216
218
}
217
219
218
220
/// A payment identifier used to uniquely identify a payment to LDK.
@@ -3777,7 +3779,8 @@ where
3777
3779
HTLCForwardInfo :: AddHTLC ( PendingAddHTLCInfo {
3778
3780
prev_short_channel_id, prev_htlc_id, prev_funding_outpoint, prev_user_channel_id,
3779
3781
forward_info : PendingHTLCInfo {
3780
- routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat, ..
3782
+ routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat,
3783
+ skimmed_fee_msat, ..
3781
3784
}
3782
3785
} ) => {
3783
3786
let ( cltv_expiry, onion_payload, payment_data, phantom_shared_secret, mut onion_fields) = match routing {
@@ -3818,6 +3821,7 @@ where
3818
3821
total_msat : if let Some ( data) = & payment_data { data. total_msat } else { outgoing_amt_msat } ,
3819
3822
cltv_expiry,
3820
3823
onion_payload,
3824
+ counterparty_skimmed_fee_msat : skimmed_fee_msat,
3821
3825
} ;
3822
3826
3823
3827
let mut committed_to_claimable = false ;
@@ -7553,31 +7557,27 @@ impl Writeable for ClaimableHTLC {
7553
7557
( 5 , self . total_value_received, option) ,
7554
7558
( 6 , self . cltv_expiry, required) ,
7555
7559
( 8 , keysend_preimage, option) ,
7560
+ ( 10 , self . counterparty_skimmed_fee_msat, option) ,
7556
7561
} ) ;
7557
7562
Ok ( ( ) )
7558
7563
}
7559
7564
}
7560
7565
7561
7566
impl Readable for ClaimableHTLC {
7562
7567
fn read < R : Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
7563
- let mut prev_hop = crate :: util:: ser:: RequiredWrapper ( None ) ;
7564
- let mut value = 0 ;
7565
- let mut sender_intended_value = None ;
7566
- let mut payment_data: Option < msgs:: FinalOnionHopData > = None ;
7567
- let mut cltv_expiry = 0 ;
7568
- let mut total_value_received = None ;
7569
- let mut total_msat = None ;
7570
- let mut keysend_preimage: Option < PaymentPreimage > = None ;
7571
- read_tlv_fields ! ( reader, {
7568
+ _init_and_read_tlv_fields ! ( reader, {
7572
7569
( 0 , prev_hop, required) ,
7573
7570
( 1 , total_msat, option) ,
7574
- ( 2 , value , required) ,
7571
+ ( 2 , value_ser , required) ,
7575
7572
( 3 , sender_intended_value, option) ,
7576
- ( 4 , payment_data , option) ,
7573
+ ( 4 , payment_data_opt , option) ,
7577
7574
( 5 , total_value_received, option) ,
7578
7575
( 6 , cltv_expiry, required) ,
7579
- ( 8 , keysend_preimage, option)
7576
+ ( 8 , keysend_preimage, option) ,
7577
+ ( 10 , counterparty_skimmed_fee_msat, option) ,
7580
7578
} ) ;
7579
+ let payment_data: Option < msgs:: FinalOnionHopData > = payment_data_opt;
7580
+ let value = value_ser. 0 . unwrap ( ) ;
7581
7581
let onion_payload = match keysend_preimage {
7582
7582
Some ( p) => {
7583
7583
if payment_data. is_some ( ) {
@@ -7606,7 +7606,8 @@ impl Readable for ClaimableHTLC {
7606
7606
total_value_received,
7607
7607
total_msat : total_msat. unwrap ( ) ,
7608
7608
onion_payload,
7609
- cltv_expiry,
7609
+ cltv_expiry : cltv_expiry. 0 . unwrap ( ) ,
7610
+ counterparty_skimmed_fee_msat,
7610
7611
} )
7611
7612
}
7612
7613
}
0 commit comments