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

Function signpsbt

plugins/spender/splice.c:1108–1139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1106}
1107
1108static struct command_result *signpsbt(struct command *cmd,
1109 struct splice_cmd *splice_cmd)
1110{
1111 struct out_req *req;
1112 size_t num_to_be_signed;
1113
1114 req = jsonrpc_request_start(cmd, "signpsbt",
1115 signpsbt_get_result, splice_error,
1116 splice_cmd);
1117
1118 /* Use input markers to identify which inputs
1119 * are ours, only sign those */
1120 json_array_start(req->js, "signonly");
1121 num_to_be_signed = 0;
1122 for (size_t i = 0; i < splice_cmd->psbt->num_inputs; i++) {
1123 if (psbt_input_is_ours(&splice_cmd->psbt->inputs[i])) {
1124 json_add_num(req->js, NULL, i);
1125 num_to_be_signed++;
1126 }
1127 }
1128 json_array_end(req->js);
1129
1130 json_add_psbt(req->js, "psbt", splice_cmd->psbt);
1131
1132 /* If we have no inputs to be signed, skip ahead */
1133 if (!num_to_be_signed) {
1134 splice_cmd->wallet_inputs_to_signed = 0;
1135 return continue_splice(splice_cmd->cmd, splice_cmd);
1136 }
1137
1138 return send_outreq(req);
1139}
1140
1141static struct splice_script_result *requires_our_sigs(struct splice_cmd *splice_cmd,
1142 size_t *index,

Callers 1

continue_spliceFunction · 0.85

Calls 7

json_array_startFunction · 0.85
psbt_input_is_oursFunction · 0.85
json_add_numFunction · 0.85
json_array_endFunction · 0.85
json_add_psbtFunction · 0.85
continue_spliceFunction · 0.85
send_outreqFunction · 0.50

Tested by

no test coverage detected