@@ -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.
@@ -3782,7 +3784,8 @@ where
3782
3784
HTLCForwardInfo :: AddHTLC ( PendingAddHTLCInfo {
3783
3785
prev_short_channel_id, prev_htlc_id, prev_funding_outpoint, prev_user_channel_id,
3784
3786
forward_info : PendingHTLCInfo {
3785
- routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat, ..
3787
+ routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat,
3788
+ skimmed_fee_msat, ..
3786
3789
}
3787
3790
} ) => {
3788
3791
let ( cltv_expiry, onion_payload, payment_data, phantom_shared_secret, mut onion_fields) = match routing {
@@ -3823,6 +3826,7 @@ where
3823
3826
total_msat : if let Some ( data) = & payment_data { data. total_msat } else { outgoing_amt_msat } ,
3824
3827
cltv_expiry,
3825
3828
onion_payload,
3829
+ counterparty_skimmed_fee_msat : skimmed_fee_msat,
3826
3830
} ;
3827
3831
3828
3832
let mut committed_to_claimable = false ;
@@ -7558,31 +7562,27 @@ impl Writeable for ClaimableHTLC {
7558
7562
( 5 , self . total_value_received, option) ,
7559
7563
( 6 , self . cltv_expiry, required) ,
7560
7564
( 8 , keysend_preimage, option) ,
7565
+ ( 10 , self . counterparty_skimmed_fee_msat, option) ,
7561
7566
} ) ;
7562
7567
Ok ( ( ) )
7563
7568
}
7564
7569
}
7565
7570
7566
7571
impl Readable for ClaimableHTLC {
7567
7572
fn read < R : Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
7568
- let mut prev_hop = crate :: util:: ser:: RequiredWrapper ( None ) ;
7569
- let mut value = 0 ;
7570
- let mut sender_intended_value = None ;
7571
- let mut payment_data: Option < msgs:: FinalOnionHopData > = None ;
7572
- let mut cltv_expiry = 0 ;
7573
- let mut total_value_received = None ;
7574
- let mut total_msat = None ;
7575
- let mut keysend_preimage: Option < PaymentPreimage > = None ;
7576
- read_tlv_fields ! ( reader, {
7573
+ _init_and_read_tlv_fields ! ( reader, {
7577
7574
( 0 , prev_hop, required) ,
7578
7575
( 1 , total_msat, option) ,
7579
- ( 2 , value , required) ,
7576
+ ( 2 , value_ser , required) ,
7580
7577
( 3 , sender_intended_value, option) ,
7581
- ( 4 , payment_data , option) ,
7578
+ ( 4 , payment_data_opt , option) ,
7582
7579
( 5 , total_value_received, option) ,
7583
7580
( 6 , cltv_expiry, required) ,
7584
- ( 8 , keysend_preimage, option)
7581
+ ( 8 , keysend_preimage, option) ,
7582
+ ( 10 , counterparty_skimmed_fee_msat, option) ,
7585
7583
} ) ;
7584
+ let payment_data: Option < msgs:: FinalOnionHopData > = payment_data_opt;
7585
+ let value = value_ser. 0 . unwrap ( ) ;
7586
7586
let onion_payload = match keysend_preimage {
7587
7587
Some ( p) => {
7588
7588
if payment_data. is_some ( ) {
@@ -7611,7 +7611,8 @@ impl Readable for ClaimableHTLC {
7611
7611
total_value_received,
7612
7612
total_msat : total_msat. unwrap ( ) ,
7613
7613
onion_payload,
7614
- cltv_expiry,
7614
+ cltv_expiry : cltv_expiry. 0 . unwrap ( ) ,
7615
+ counterparty_skimmed_fee_msat,
7615
7616
} )
7616
7617
}
7617
7618
}
0 commit comments