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

Function json_payersign

lightningd/offer.c:572–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570AUTODATA(json_command, &createinvreq_command);
571
572static struct command_result *json_payersign(struct command *cmd,
573 const char *buffer,
574 const jsmntok_t *obj UNNEEDED,
575 const jsmntok_t *params)
576{
577 struct json_stream *response;
578 struct sha256 *merkle;
579 u8 *tweak;
580 struct bip340sig sig;
581 const char *messagename, *fieldname;
582 struct pubkey key;
583
584 if (!param(cmd, buffer, params,
585 p_req("messagename", param_string, &messagename),
586 p_req("fieldname", param_string, &fieldname),
587 p_req("merkle", param_sha256, &merkle),
588 p_req("tweak", param_bin_from_hex, &tweak),
589 NULL))
590 return command_param_failed();
591
592 payer_key(cmd->ld, tweak, tal_bytelen(tweak), &key);
593 hsm_sign_b12(cmd->ld, messagename, fieldname, merkle,
594 tweak, &key, &sig);
595
596 response = json_stream_success(cmd);
597 json_add_string(response, "signature", fmt_bip340sig(tmpctx, &sig));
598 return command_success(cmd, response);
599}
600
601static const struct json_command payersign_command = {
602 "payersign",

Callers

nothing calls this directly

Calls 9

tal_bytelenFunction · 0.85
hsm_sign_b12Function · 0.85
fmt_bip340sigFunction · 0.85
command_param_failedFunction · 0.70
payer_keyFunction · 0.70
json_stream_successFunction · 0.70
command_successFunction · 0.70
paramFunction · 0.50
json_add_stringFunction · 0.50

Tested by

no test coverage detected