| 215 | } |
| 216 | |
| 217 | static 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 | |
| 252 | static struct command_result *listsendpays_done(struct command *cmd, |
| 253 | const char *method UNNEEDED, |
nothing calls this directly
no test coverage detected