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

Add counterparty_skimmed_fee_msat field to PaymentKind::Bolt11Jit #497

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Mar 19, 2025

Closes #495

We add a field to Bolt11Jit describing exactly how much the LSP withheld.

Additionally, we clarify when PaymentDetails::amount_msat might be None (for now).

@tnull tnull added this to the 0.5 milestone Mar 19, 2025
@tnull tnull requested a review from G8XSU March 19, 2025 09:14
@tnull tnull mentioned this pull request Mar 19, 2025
@tnull tnull force-pushed the 2025-03-payment-details-nits branch from ffad4f3 to 05c77da Compare March 19, 2025 09:25
PaymentKind::Bolt11Jit { ref mut counterparty_skimmed_fee_msat, .. } => {
update_if_necessary!(*counterparty_skimmed_fee_msat, skimmed_fee_msat);
},
_ => {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of silently ignoring the payment_update here, should we add a debug_assert?

assert_eq!(hash, h);
assert_eq!(preimage, p);
assert_eq!(secret, s);
assert_eq!(None, c);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we test with Some() as well?

@@ -346,6 +364,12 @@ pub enum PaymentKind {
preimage: Option<PaymentPreimage>,
/// The secret used by the payment.
secret: Option<PaymentSecret>,
/// The value, in thousands of a satoshi, that was deducted off of this payment as an extra
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The value, in thousands of a satoshi" is an awkward way of saying that the value is in msat?
where msat is thousandth of a satoshi.

Suggested change
/// The value, in thousands of a satoshi, that was deducted off of this payment as an extra
/// The value, in millisatoshis (msat), that was deducted off of this payment as an extra

@@ -41,6 +41,8 @@ pub struct PaymentDetails {
/// The kind of the payment.
pub kind: PaymentKind,
/// The amount transferred.
///
/// Will be `None` for variable-amount payments until we received them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Will be `None` for variable-amount payments until we received them.
/// Will be `None` for variable-amount payments until we receive them.

@@ -346,6 +364,12 @@ pub enum PaymentKind {
preimage: Option<PaymentPreimage>,
/// The secret used by the payment.
secret: Option<PaymentSecret>,
/// The value, in thousands of a satoshi, that was deducted off of this payment as an extra
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// The value, in thousands of a satoshi, that was deducted off of this payment as an extra
/// The extra fee, in millisatoshis (msat), deducted from this payment by our channel counterparty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When can PaymentDetails::amount be None
2 participants