@@ -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.
@@ -3776,7 +3778,8 @@ where
3776
3778
HTLCForwardInfo :: AddHTLC ( PendingAddHTLCInfo {
3777
3779
prev_short_channel_id, prev_htlc_id, prev_funding_outpoint, prev_user_channel_id,
3778
3780
forward_info : PendingHTLCInfo {
3779
- routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat, ..
3781
+ routing, incoming_shared_secret, payment_hash, incoming_amt_msat, outgoing_amt_msat,
3782
+ skimmed_fee_msat, ..
3780
3783
}
3781
3784
} ) => {
3782
3785
let ( cltv_expiry, onion_payload, payment_data, phantom_shared_secret, mut onion_fields) = match routing {
@@ -3817,6 +3820,7 @@ where
3817
3820
total_msat : if let Some ( data) = & payment_data { data. total_msat } else { outgoing_amt_msat } ,
3818
3821
cltv_expiry,
3819
3822
onion_payload,
3823
+ counterparty_skimmed_fee_msat : skimmed_fee_msat,
3820
3824
} ;
3821
3825
3822
3826
let mut committed_to_claimable = false ;
@@ -7615,31 +7619,27 @@ impl Writeable for ClaimableHTLC {
7615
7619
( 5 , self . total_value_received, option) ,
7616
7620
( 6 , self . cltv_expiry, required) ,
7617
7621
( 8 , keysend_preimage, option) ,
7622
+ ( 10 , self . counterparty_skimmed_fee_msat, option) ,
7618
7623
} ) ;
7619
7624
Ok ( ( ) )
7620
7625
}
7621
7626
}
7622
7627
7623
7628
impl Readable for ClaimableHTLC {
7624
7629
fn read < R : Read > ( reader : & mut R ) -> Result < Self , DecodeError > {
7625
- let mut prev_hop = crate :: util:: ser:: RequiredWrapper ( None ) ;
7626
- let mut value = 0 ;
7627
- let mut sender_intended_value = None ;
7628
- let mut payment_data: Option < msgs:: FinalOnionHopData > = None ;
7629
- let mut cltv_expiry = 0 ;
7630
- let mut total_value_received = None ;
7631
- let mut total_msat = None ;
7632
- let mut keysend_preimage: Option < PaymentPreimage > = None ;
7633
- read_tlv_fields ! ( reader, {
7630
+ _init_and_read_tlv_fields ! ( reader, {
7634
7631
( 0 , prev_hop, required) ,
7635
7632
( 1 , total_msat, option) ,
7636
- ( 2 , value , required) ,
7633
+ ( 2 , value_ser , required) ,
7637
7634
( 3 , sender_intended_value, option) ,
7638
- ( 4 , payment_data , option) ,
7635
+ ( 4 , payment_data_opt , option) ,
7639
7636
( 5 , total_value_received, option) ,
7640
7637
( 6 , cltv_expiry, required) ,
7641
- ( 8 , keysend_preimage, option)
7638
+ ( 8 , keysend_preimage, option) ,
7639
+ ( 10 , counterparty_skimmed_fee_msat, option) ,
7642
7640
} ) ;
7641
+ let payment_data: Option < msgs:: FinalOnionHopData > = payment_data_opt;
7642
+ let value = value_ser. 0 . unwrap ( ) ;
7643
7643
let onion_payload = match keysend_preimage {
7644
7644
Some ( p) => {
7645
7645
if payment_data. is_some ( ) {
@@ -7668,7 +7668,8 @@ impl Readable for ClaimableHTLC {
7668
7668
total_value_received,
7669
7669
total_msat : total_msat. unwrap ( ) ,
7670
7670
onion_payload,
7671
- cltv_expiry,
7671
+ cltv_expiry : cltv_expiry. 0 . unwrap ( ) ,
7672
+ counterparty_skimmed_fee_msat,
7672
7673
} )
7673
7674
}
7674
7675
}
0 commit comments