| 614 | }; |
| 615 | |
| 616 | static void getutxout_callback(const char *buf, const jsmntok_t *toks, |
| 617 | const jsmntok_t *idtok, |
| 618 | struct getutxout_call *call) |
| 619 | { |
| 620 | const jsmntok_t *resulttok; |
| 621 | const char *err; |
| 622 | struct bitcoin_tx_output txout; |
| 623 | |
| 624 | /* Whatever happens, we want to free this. */ |
| 625 | tal_steal(tmpctx, call); |
| 626 | |
| 627 | resulttok = get_bitcoin_result(call->bitcoind, buf, toks, "getutxout"); |
| 628 | |
| 629 | err = json_scan(tmpctx, buf, resulttok, "{script:null}"); |
| 630 | if (!err) { |
| 631 | call->cb(call->bitcoind, NULL, call->cb_arg); |
| 632 | return; |
| 633 | } |
| 634 | |
| 635 | err = json_scan(tmpctx, buf, resulttok, "{script:%,amount:%}", |
| 636 | JSON_SCAN_TAL(tmpctx, json_tok_bin_from_hex, |
| 637 | &txout.script), |
| 638 | JSON_SCAN(json_to_sat, &txout.amount)); |
| 639 | if (err) |
| 640 | bitcoin_plugin_error(call->bitcoind, buf, resulttok, "getutxout", |
| 641 | "bad 'result' field: %s", err); |
| 642 | |
| 643 | call->cb(call->bitcoind, &txout, call->cb_arg); |
| 644 | } |
| 645 | |
| 646 | void bitcoind_getutxout_(const tal_t *ctx, |
| 647 | struct bitcoind *bitcoind, |
nothing calls this directly
no test coverage detected