offers: import latest variant from draft.

In particular, this changes the name of a field in invoice_request:
`payer_signature` becomes simply `signature`.  So we allow both for
now, and send the old one unless deprecated_apis is disabled.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-03-22 19:20:13 +10:30
parent e36d4d1143
commit 726b6878d1
10 changed files with 96 additions and 52 deletions

View File

@@ -1192,11 +1192,14 @@ force_payer_secret(struct command *cmd,
"Could not remarshall invreq %s", tal_hex(tmpctx, msg));
merkle_tlv(sent->invreq->fields, &merkle);
sighash_from_merkle("invoice_request", "payer_signature", &merkle, &sha);
if (deprecated_apis)
sighash_from_merkle("invoice_request", "payer_signature", &merkle, &sha);
else
sighash_from_merkle("invoice_request", "signature", &merkle, &sha);
sent->invreq->payer_signature = tal(invreq, struct bip340sig);
sent->invreq->signature = tal(invreq, struct bip340sig);
if (!secp256k1_schnorrsig_sign(secp256k1_ctx,
sent->invreq->payer_signature->u8,
sent->invreq->signature->u8,
sha.u.u8,
&kp,
NULL, NULL)) {