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

@@ -380,6 +380,7 @@ void htlc_set_add_(struct lightningd *ld UNNEEDED,
struct logger *log UNNEEDED,
struct amount_msat msat UNNEEDED,
struct amount_msat total_msat UNNEEDED,
const struct amount_msat *invoice_msat_override UNNEEDED,
const struct sha256 *payment_hash UNNEEDED,
const struct secret *payment_secret UNNEEDED,
void (*fail)(void * UNNEEDED, const u8 *) UNNEEDED,