mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
chaintopology: dont check bitcoin-core version at startup
The Bitcoin backend is generalized through the Bitcoin plugin and this was specific to core.
This commit is contained in:
@@ -890,66 +890,6 @@ void bitcoind_getfilteredblock_(struct bitcoind *bitcoind, u32 height,
|
|||||||
bitcoind_getblockhash(bitcoind, height, process_getfilteredblock_step1, call);
|
bitcoind_getblockhash(bitcoind, height, process_getfilteredblock_step1, call);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool extract_numeric_version(struct bitcoin_cli *bcli,
|
|
||||||
const char *output, size_t output_bytes,
|
|
||||||
u64 *version)
|
|
||||||
{
|
|
||||||
const jsmntok_t *tokens, *versiontok;
|
|
||||||
bool valid;
|
|
||||||
|
|
||||||
tokens = json_parse_input(output, output, output_bytes, &valid);
|
|
||||||
if (!tokens)
|
|
||||||
fatal("%s: %s response",
|
|
||||||
bcli_args(tmpctx, bcli),
|
|
||||||
valid ? "partial" : "invalid");
|
|
||||||
|
|
||||||
if (tokens[0].type != JSMN_OBJECT) {
|
|
||||||
log_unusual(bcli->bitcoind->log,
|
|
||||||
"%s: gave non-object (%.*s)?",
|
|
||||||
bcli_args(tmpctx, bcli),
|
|
||||||
(int)output_bytes, output);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
versiontok = json_get_member(output, tokens, "version");
|
|
||||||
if (!versiontok)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return json_to_u64(output, versiontok, version);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool process_getclientversion(struct bitcoin_cli *bcli)
|
|
||||||
{
|
|
||||||
u64 version;
|
|
||||||
u64 min_version = chainparams->cli_min_supported_version;
|
|
||||||
|
|
||||||
if (!extract_numeric_version(bcli, bcli->output,
|
|
||||||
bcli->output_bytes,
|
|
||||||
&version)) {
|
|
||||||
fatal("%s: Unable to getclientversion (%.*s)",
|
|
||||||
bcli_args(tmpctx, bcli),
|
|
||||||
(int)bcli->output_bytes,
|
|
||||||
bcli->output);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (version < min_version)
|
|
||||||
fatal("Unsupported bitcoind version? bitcoind version: %"PRIu64","
|
|
||||||
" supported minimum version: %"PRIu64"",
|
|
||||||
version, min_version);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void bitcoind_getclientversion(struct bitcoind *bitcoind)
|
|
||||||
{
|
|
||||||
/* `getnetworkinfo` was added in v0.14.0. The older version would
|
|
||||||
* return non-zero exitstatus. */
|
|
||||||
start_bitcoin_cli(bitcoind, NULL, process_getclientversion, false,
|
|
||||||
BITCOIND_HIGH_PRIO,
|
|
||||||
NULL, NULL,
|
|
||||||
"getnetworkinfo", NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mutual recursion */
|
/* Mutual recursion */
|
||||||
static bool process_getblockchaininfo(struct bitcoin_cli *bcli);
|
static bool process_getblockchaininfo(struct bitcoin_cli *bcli);
|
||||||
|
|
||||||
|
|||||||
@@ -961,8 +961,6 @@ void setup_topology(struct chain_topology *topo,
|
|||||||
/* Make sure bitcoind is started, and ready */
|
/* Make sure bitcoind is started, and ready */
|
||||||
wait_for_bitcoind(topo->bitcoind);
|
wait_for_bitcoind(topo->bitcoind);
|
||||||
|
|
||||||
bitcoind_getclientversion(topo->bitcoind);
|
|
||||||
|
|
||||||
bitcoind_getblockcount(topo->bitcoind, get_init_blockhash, topo);
|
bitcoind_getblockcount(topo->bitcoind, get_init_blockhash, topo);
|
||||||
|
|
||||||
tal_add_destructor(topo, destroy_chain_topology);
|
tal_add_destructor(topo, destroy_chain_topology);
|
||||||
|
|||||||
Reference in New Issue
Block a user