| 522 | }; |
| 523 | |
| 524 | static void getchaininfo_callback(const char *buf, const jsmntok_t *toks, |
| 525 | const jsmntok_t *idtok, |
| 526 | struct getchaininfo_call *call) |
| 527 | { |
| 528 | const jsmntok_t *resulttok; |
| 529 | const char *err, *chain; |
| 530 | u32 headers, blocks; |
| 531 | bool ibd; |
| 532 | |
| 533 | resulttok = get_bitcoin_result(call->bitcoind, buf, toks, "getchaininfo"); |
| 534 | |
| 535 | err = json_scan(tmpctx, buf, resulttok, |
| 536 | "{chain:%,headercount:%,blockcount:%,ibd:%}", |
| 537 | JSON_SCAN_TAL(tmpctx, json_strdup, &chain), |
| 538 | JSON_SCAN(json_to_number, &headers), |
| 539 | JSON_SCAN(json_to_number, &blocks), |
| 540 | JSON_SCAN(json_to_bool, &ibd)); |
| 541 | if (err) |
| 542 | bitcoin_plugin_error(call->bitcoind, buf, resulttok, "getchaininfo", |
| 543 | "bad 'result' field: %s", err); |
| 544 | |
| 545 | call->cb(call->bitcoind, chain, headers, blocks, ibd, |
| 546 | call->cb_arg); |
| 547 | |
| 548 | tal_free(call); |
| 549 | } |
| 550 | |
| 551 | void bitcoind_getchaininfo_(const tal_t *ctx, |
| 552 | struct bitcoind *bitcoind, |
nothing calls this directly
no test coverage detected