@@ -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.
@@ -3772,7 +3774,8 @@ where
3772
3774
HTLCForwardInfo :: AddHTLC ( PendingAddHTLCInfo {
3773
3775
prev_short_channel_id, prev_htlc_id, prev_funding_outpoint, prev_user_channel_id,
3774
3776
forward_info : PendingHTLCInfo {
3775
- routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat, ..
3777
+ routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat,
3778
+ skimmed_fee_msat, ..
3776
3779
}
3777
3780
} ) => {
3778
3781
let ( cltv_expiry, onion_payload, payment_data, phantom_shared_secret, mut onion_fields) = match routing {
@@ -3813,6 +3816,7 @@ where
3813
3816
total_msat : if let Some ( data) = & payment_data { data. total_msat } else { outgoing_amt_msat } ,
3814
3817
cltv_expiry,
3815
3818
onion_payload,
3819
+ counterparty_skimmed_fee_msat : skimmed_fee_msat,
3816
3820
} ;
3817
3821
3818
3822
let mut committed_to_claimable = false ;
@@ -7548,31 +7552,27 @@ impl Writeable for ClaimableHTLC {
7548
7552
( 5 , self . total_value_received, option) ,
7549
7553
( 6 , self . cltv_expiry, required) ,
7550
7554
( 8 , keysend_preimage, option) ,
7555
+ ( 10 , self . counterparty_skimmed_fee_msat, option) ,
7551
7556
} ) ;
7552
7557
Ok ( ( ) )
7553
7558
}
7554
7559
}
7555
7560
7556
7561
impl Readable for ClaimableHTLC {
7557
7562
fn read < R : Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
7558
- let mut prev_hop = crate :: util:: ser:: RequiredWrapper ( None ) ;
7559
- let mut value = 0 ;
7560
- let mut sender_intended_value = None ;
7561
- let mut payment_data: Option < msgs:: FinalOnionHopData > = None ;
7562
- let mut cltv_expiry = 0 ;
7563
- let mut total_value_received = None ;
7564
- let mut total_msat = None ;
7565
- let mut keysend_preimage: Option < PaymentPreimage > = None ;
7566
- read_tlv_fields ! ( reader, {
7563
+ _init_and_read_tlv_fields ! ( reader, {
7567
7564
( 0 , prev_hop, required) ,
7568
7565
( 1 , total_msat, option) ,
7569
- ( 2 , value , required) ,
7566
+ ( 2 , value_ser , required) ,
7570
7567
( 3 , sender_intended_value, option) ,
7571
- ( 4 , payment_data , option) ,
7568
+ ( 4 , payment_data_opt , option) ,
7572
7569
( 5 , total_value_received, option) ,
7573
7570
( 6 , cltv_expiry, required) ,
7574
- ( 8 , keysend_preimage, option)
7571
+ ( 8 , keysend_preimage, option) ,
7572
+ ( 10 , counterparty_skimmed_fee_msat, option) ,
7575
7573
} ) ;
7574
+ let payment_data: Option < msgs:: FinalOnionHopData > = payment_data_opt;
7575
+ let value = value_ser. 0 . unwrap ( ) ;
7576
7576
let onion_payload = match keysend_preimage {
7577
7577
Some ( p) => {
7578
7578
if payment_data. is_some ( ) {
@@ -7601,7 +7601,8 @@ impl Readable for ClaimableHTLC {
7601
7601
total_value_received,
7602
7602
total_msat : total_msat. unwrap ( ) ,
7603
7603
onion_payload,
7604
- cltv_expiry,
7604
+ cltv_expiry : cltv_expiry. 0 . unwrap ( ) ,
7605
+ counterparty_skimmed_fee_msat,
7605
7606
} )
7606
7607
}
7607
7608
}
0 commit comments