| 424 | } |
| 425 | |
| 426 | static struct command_result *json_dev_rescan_outputs(struct command *cmd, |
| 427 | const char *buffer, |
| 428 | const jsmntok_t *obj UNNEEDED, |
| 429 | const jsmntok_t *params) |
| 430 | { |
| 431 | struct txo_rescan *rescan = tal(cmd, struct txo_rescan); |
| 432 | |
| 433 | if (!param(cmd, buffer, params, NULL)) |
| 434 | return command_param_failed(); |
| 435 | |
| 436 | rescan->response = json_stream_success(cmd); |
| 437 | rescan->cmd = cmd; |
| 438 | |
| 439 | /* Open the outputs structure so we can incrementally add results */ |
| 440 | json_array_start(rescan->response, "outputs"); |
| 441 | rescan->utxos = wallet_get_utxos(rescan, cmd->ld->wallet, OUTPUT_STATE_ANY); |
| 442 | if (tal_count(rescan->utxos) == 0) { |
| 443 | json_array_end(rescan->response); |
| 444 | return command_success(cmd, rescan->response); |
| 445 | } |
| 446 | bitcoind_getutxout(cmd->ld->topology->bitcoind, |
| 447 | &rescan->utxos[0]->outpoint, |
| 448 | process_utxo_result, |
| 449 | rescan); |
| 450 | return command_still_pending(cmd); |
| 451 | } |
| 452 | |
| 453 | static const struct json_command dev_rescan_output_command = { |
| 454 | "dev-rescan-outputs", |
nothing calls this directly
no test coverage detected