MCPcopy Create free account
hub / github.com/ElementsProject/lightning / check_payer_sig

Function check_payer_sig

plugins/offers_invreq_hook.c:426–440  ·  view source on GitHub ↗

BOLT-offers #12: * - MUST fail the request if `signature` is not correct. */

Source from the content-addressed store, hash-verified

424 * - MUST fail the request if `signature` is not correct.
425 */
426static bool check_payer_sig(struct command *cmd,
427 const struct tlv_invoice_request *invreq,
428 const struct point32 *payer_key,
429 const struct bip340sig *sig)
430{
431 struct sha256 merkle, sighash;
432 merkle_tlv(invreq->fields, &merkle);
433 sighash_from_merkle("invoice_request", "signature", &merkle, &sighash);
434
435 return secp256k1_schnorrsig_verify(secp256k1_ctx,
436 sig->u8,
437 sighash.u.u8,
438 sizeof(sighash.u.u8),
439 &payer_key->pubkey) == 1;
440}
441
442static struct command_result *invreq_amount_by_quantity(struct command *cmd,
443 const struct invreq *ir,

Callers 1

listoffers_doneFunction · 0.85

Calls 2

merkle_tlvFunction · 0.50
sighash_from_merkleFunction · 0.50

Tested by

no test coverage detected