| 540 | }; |
| 541 | |
| 542 | static void getchaininfo_callback(const char *buf, const jsmntok_t *toks, |
| 543 | const jsmntok_t *idtok, |
| 544 | struct getchaininfo_call *call) |
| 545 | { |
| 546 | const jsmntok_t *resulttok; |
| 547 | const char *err, *chain; |
| 548 | u32 headers, blocks; |
| 549 | bool ibd; |
| 550 | |
| 551 | resulttok = get_bitcoin_result(call->bitcoind, buf, toks, "getchaininfo"); |
| 552 | |
| 553 | err = json_scan(tmpctx, buf, resulttok, |
| 554 | "{chain:%,headercount:%,blockcount:%,ibd:%}", |
| 555 | JSON_SCAN_TAL(tmpctx, json_strdup, &chain), |
| 556 | JSON_SCAN(json_to_number, &headers), |
| 557 | JSON_SCAN(json_to_number, &blocks), |
| 558 | JSON_SCAN(json_to_bool, &ibd)); |
| 559 | if (err) |
| 560 | bitcoin_plugin_error(call->bitcoind, buf, resulttok, "getchaininfo", |
| 561 | "bad 'result' field: %s", err); |
| 562 | |
| 563 | call->cb(call->bitcoind, chain, headers, blocks, ibd, |
| 564 | call->cb_arg); |
| 565 | |
| 566 | tal_free(call); |
| 567 | } |
| 568 | |
| 569 | void bitcoind_getchaininfo_(const tal_t *ctx, |
| 570 | struct bitcoind *bitcoind, |
nothing calls this directly
no test coverage detected