| 544 | } |
| 545 | |
| 546 | static struct command_result *json_dev_rescan_outputs(struct command *cmd, |
| 547 | const char *buffer, |
| 548 | const jsmntok_t *obj UNNEEDED, |
| 549 | const jsmntok_t *params) |
| 550 | { |
| 551 | struct txo_rescan *rescan = tal(cmd, struct txo_rescan); |
| 552 | |
| 553 | if (!param(cmd, buffer, params, NULL)) |
| 554 | return command_param_failed(); |
| 555 | |
| 556 | rescan->response = json_stream_success(cmd); |
| 557 | rescan->cmd = cmd; |
| 558 | |
| 559 | /* Open the outputs structure so we can incrementally add results */ |
| 560 | json_array_start(rescan->response, "outputs"); |
| 561 | rescan->utxos = wallet_get_all_utxos(rescan, cmd->ld->wallet); |
| 562 | if (tal_count(rescan->utxos) == 0) { |
| 563 | json_array_end(rescan->response); |
| 564 | return command_success(cmd, rescan->response); |
| 565 | } |
| 566 | bitcoind_getutxout(rescan, cmd->ld->topology->bitcoind, |
| 567 | &rescan->utxos[0]->outpoint, |
| 568 | process_utxo_result, |
| 569 | rescan); |
| 570 | return command_still_pending(cmd); |
| 571 | } |
| 572 | |
| 573 | static const struct json_command dev_rescan_output_command = { |
| 574 | "dev-rescan-outputs", |
nothing calls this directly
no test coverage detected