lightningd: add invoice_amt to the htlc_accepted hook

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 <pet.v.ne@gmail.com>
This commit is contained in:
Peter Neuroth
2025-11-06 16:40:08 +01:00
committed by Rusty Russell
parent 572c4553a2
commit 21fb7600f3
8 changed files with 96 additions and 6 deletions

View File

@@ -462,6 +462,8 @@ It can also specify `forward_to` in the response, replacing the destination. Th
Also, it can specify `extra_tlvs` in the response. This will replace the TLV-stream `update_add_htlc_tlvs` in the `update_add_htlc` message for forwarded htlcs.
If the node is the final destination, the plugin can also replace the amount of the invoice that belongs to the `payment_hash` by specifying `invoice_msat`.
```json
{
"result": "fail",