| 469 | } |
| 470 | |
| 471 | struct command_result *json_createproof(struct command *cmd, |
| 472 | const char *buffer, |
| 473 | const jsmntok_t *params) |
| 474 | { |
| 475 | struct createproof_state *state; |
| 476 | struct out_req *req; |
| 477 | |
| 478 | state = tal(cmd, struct createproof_state); |
| 479 | if (!param(cmd, buffer, params, |
| 480 | p_req("invstring", param_bolt12_invstring, &state->invinfo), |
| 481 | p_opt("note", param_string, &state->note), |
| 482 | p_opt("include", param_include_types, &state->include_types), |
| 483 | NULL)) |
| 484 | return command_param_failed(); |
| 485 | |
| 486 | if (!state->include_types) { |
| 487 | /* Default: mandatory + extras */ |
| 488 | state->include_types = tal_arr(state, bigsize_t, 0); |
| 489 | for (size_t i = 0; i < ARRAY_SIZE(mandatory_types); i++) |
| 490 | tal_arr_expand(&state->include_types, mandatory_types[i]); |
| 491 | for (size_t i = 0; i < ARRAY_SIZE(default_extras); i++) |
| 492 | tal_arr_expand(&state->include_types, default_extras[i]); |
| 493 | } |
| 494 | |
| 495 | /* Look up completed payments. |
| 496 | * For bolt12 invoices, listsendpays filters by payment_hash. |
| 497 | * For offers and BIP353, we get all and filter in the callback. */ |
| 498 | req = jsonrpc_request_start(cmd, "listsendpays", |
| 499 | &listsendpays_done, |
| 500 | &forward_error, |
| 501 | state); |
| 502 | if (state->invinfo->type == INVTYPE_INVOICE) |
| 503 | json_add_string(req->js, "bolt11", state->invinfo->invstring); |
| 504 | json_add_string(req->js, "status", "complete"); |
| 505 | return send_outreq(req); |
| 506 | } |
nothing calls this directly
no test coverage detected