Skip to content

Conversation

@nepet
Copy link
Collaborator

@nepet nepet commented Nov 7, 2025

Important

25.12 FREEZE October 27th: Non-bugfix PRs not ready by this date will wait for 26.03.

RC1 is scheduled on November 10th

The final release is scheduled for December 1st.

Checklist

Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked:

  • The changelog has been updated in the relevant commit(s) according to the guidelines.
  • Tests have been added or modified to reflect the changes.
  • Documentation has been reviewed and updated as needed.
  • Related issues have been listed and linked, including any that this PR closes.

Allow plugins to override the effective invoice amount during payment checks from the htlc_accepted hook. This enables use-cases where the actually expected (or allowed) amount differs from the amount encoded in the original invoice.

This is especially useful for LSP clients on Greenlight. An LSP client expects an amount that is reduced by the opening fee that the LSP deducts from the HTLC set belonging to a certain invoice. Typically that would necessitate signing two different invoices with the same payment hash: one with the expected amount and another with the opening fee added to the amount. Using this hook instead saves Greenlight nodes some round trips to the signer.

  • The overwritten amount is reflected in the amount_received_msat field in listinvoices calls.
  • Bookkeeper correctly uses the overwritten amount.

@nepet nepet force-pushed the 2544-add-total_amt_msat-to-htlc_accepted_hook branch 2 times, most recently from 17695a5 to bd26406 Compare November 7, 2025 11:38
nepet added 2 commits November 7, 2025 12:51
Adds `expected_msat_override` to the `invoice_check_payment` check. If
it's set, it will be used to override the invoice amount as the expected
amount of the payment check.

This enables us to charge a different amount for a payment than the
amount stated on the invoice.

Signed-off-by: Peter Neuroth <[email protected]>
This commit introduces a new field `invoice_msat` to the htlc_accepted
hook. If this field is specified it will replace the amount of the
invoice that belongs to the payment_hash of the HTLC on internal checks.

This is useful in scenarios where we actually expect a smaller amount
than initially specified in an invoice.

Changelog-Changed: Plugins: `htlc_accepted` hook can now override the
expected total amount of the invoice that belongs to the HTLC.

Signed-off-by: Peter Neuroth <[email protected]>
@nepet nepet force-pushed the 2544-add-total_amt_msat-to-htlc_accepted_hook branch from bd26406 to 5c0bb5a Compare November 7, 2025 11:53
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.

1 participant