]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Include counterparty skimmed fees in PaymentClaimed event.
authorValentine Wallace <vwallace@protonmail.com>
Tue, 7 Nov 2023 20:08:55 +0000 (15:08 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Tue, 7 Nov 2023 20:08:55 +0000 (15:08 -0500)
lightning/src/events/mod.rs
lightning/src/ln/channelmanager.rs

index 32192297432d1873c6898e79ccf41f8b66ada62a..5ffea4ee6485399f070b65f3e3798775c58a0693 100644 (file)
@@ -102,9 +102,15 @@ pub struct ClaimedHTLC {
        pub cltv_expiry: u32,
        /// The amount (in msats) of this part of an MPP.
        pub value_msat: u64,
+       /// The extra fee our counterparty skimmed off the top of this HTLC, if any.
+       ///
+       /// This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to
+       /// 0.0.119.
+       pub counterparty_skimmed_fee_msat: u64,
 }
 impl_writeable_tlv_based!(ClaimedHTLC, {
        (0, channel_id, required),
+       (1, counterparty_skimmed_fee_msat, (default_value, 0u64)),
        (2, user_channel_id, required),
        (4, cltv_expiry, required),
        (6, value_msat, required),
index 6aff4878820784f527221b5748f57aa14f6dad00..3d698603551d75d1d8a4a58e788de3e74ed4a72d 100644 (file)
@@ -238,6 +238,7 @@ impl From<&ClaimableHTLC> for events::ClaimedHTLC {
                        user_channel_id: val.prev_hop.user_channel_id.unwrap_or(0),
                        cltv_expiry: val.cltv_expiry,
                        value_msat: val.value,
+                       counterparty_skimmed_fee_msat: val.counterparty_skimmed_fee_msat.unwrap_or(0),
                }
        }
 }