MCPcopy Create free account
hub / github.com/ElementsProject/lightning / getchaininfo_callback

Function getchaininfo_callback

lightningd/bitcoind.c:524–549  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522};
523
524static 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
551void bitcoind_getchaininfo_(const tal_t *ctx,
552 struct bitcoind *bitcoind,

Callers

nothing calls this directly

Calls 4

get_bitcoin_resultFunction · 0.85
bitcoin_plugin_errorFunction · 0.85
tal_freeFunction · 0.85
json_scanFunction · 0.50

Tested by

no test coverage detected