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

Function payersign_done

plugins/offers_proof.c:217–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217static struct command_result *payersign_done(struct command *cmd,
218 const char *method UNNEEDED,
219 const char *buf,
220 const jsmntok_t *result,
221 struct one_proof *proof)
222{
223 struct createproof_state *state = proof->state;
224 const jsmntok_t *sigtok;
225
226 proof->pptlv->proof_signature = tal(proof->pptlv, struct bip340sig);
227 sigtok = json_get_member(buf, result, "signature");
228 if (!sigtok)
229 plugin_err(cmd->plugin, "payersign: no signature in result");
230 if (!json_to_bip340sig(buf, sigtok, proof->pptlv->proof_signature))
231 plugin_err(cmd->plugin, "payersign: bad signature hex");
232
233 /* Encode as lnp1... string */
234 proof->encoded = payer_proof_encode(proof, proof->pptlv);
235
236 /* When all outstanding are done, output all proofs and finish */
237 if (--state->n_outstanding != 0)
238 return command_still_pending(cmd);
239
240 struct json_stream *response = jsonrpc_stream_success(cmd);
241 json_array_start(response, "proofs");
242 for (size_t i = 0; i < tal_count(state->proofs); i++) {
243 json_object_start(response, NULL);
244 json_add_string(response, "bolt12", state->proofs[i]->encoded);
245 json_add_fields_included(response, state->proofs[i]->pptlv);
246 json_object_end(response);
247 }
248 json_array_end(response);
249 return command_finished(cmd, response);
250}
251
252static struct command_result *listsendpays_done(struct command *cmd,
253 const char *method UNNEEDED,

Callers

nothing calls this directly

Calls 13

json_get_memberFunction · 0.85
json_to_bip340sigFunction · 0.85
payer_proof_encodeFunction · 0.85
json_array_startFunction · 0.85
json_object_startFunction · 0.85
json_add_fields_includedFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85
plugin_errFunction · 0.70
command_still_pendingFunction · 0.70
jsonrpc_stream_successFunction · 0.70
command_finishedFunction · 0.70

Tested by

no test coverage detected