Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete underpaying HTLCs support #2715

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lightning/src/events/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions lightning/src/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,9 @@ pub struct ChannelConfig {
/// - The counterparty will get an [`HTLCIntercepted`] event upon payment forward, and call
/// [`forward_intercepted_htlc`] with less than the amount provided in
/// [`HTLCIntercepted::expected_outbound_amount_msat`]. The difference between the expected and
/// actual forward amounts is their fee.
// TODO: link to LSP JIT channel invoice generation spec when it's merged
/// actual forward amounts is their fee. See
/// <https://github.com/BitcoinAndLightningLayerSpecs/lsp/tree/main/LSPS2#flow-lsp-trusts-client-model>
/// for how this feature may be used in the LSP use case.
///
/// # Note
/// It's important for payee wallet software to verify that [`PaymentClaimable::amount_msat`] is
Expand Down