offers: include the payer_note field in the invoice if it's in the request.

And list it in bolt12-cli decode, and the `decode` command.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-07-02 09:41:35 +09:30
parent 18b6aa5e66
commit 12dd3a439b
3 changed files with 24 additions and 0 deletions

View File

@@ -819,6 +819,14 @@ static struct command_result *listoffers_done(struct command *cmd,
ir->inv->payer_info
= tal_dup_talarr(ir->inv, u8, ir->invreq->payer_info);
/* BOLT-offers #12:
* - MUST set (or not set) `payer_note` exactly as the invoice_request
* did, or MUST not set it.
*/
/* i.e. we don't have to do anything, but we do. */
ir->inv->payer_note
= tal_dup_talarr(ir->inv, char, ir->invreq->payer_note);
randombytes_buf(&ir->preimage, sizeof(ir->preimage));
ir->inv->payment_hash = tal(ir->inv, struct sha256);
sha256(ir->inv->payment_hash, &ir->preimage, sizeof(ir->preimage));