mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-07 16:14:26 +01:00
lightningd: fix fatal error on startup if bitcoind isn't ready.
At the moment we simply get a crypto log line on exit:
bitcoin-cli getblockchaininfo: invalid response
Fixes: 6deed77d88
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -881,10 +881,6 @@ void wait_for_bitcoind(struct bitcoind *bitcoind)
|
||||
|
||||
char *output = grab_fd(cmd, from);
|
||||
|
||||
errstr = check_blockchain_from_bitcoincli(tmpctx, bitcoind, output, cmd);
|
||||
if(errstr)
|
||||
fatal("%s", errstr);
|
||||
|
||||
while ((ret = waitpid(child, &status, 0)) < 0 && errno == EINTR);
|
||||
if (ret != child)
|
||||
fatal("Waiting for %s: %s", cmd[0], strerror(errno));
|
||||
@@ -892,8 +888,14 @@ void wait_for_bitcoind(struct bitcoind *bitcoind)
|
||||
fatal("Death of %s: signal %i",
|
||||
cmd[0], WTERMSIG(status));
|
||||
|
||||
if (WEXITSTATUS(status) == 0)
|
||||
if (WEXITSTATUS(status) == 0) {
|
||||
/* If succeeded, so check answer it gave. */
|
||||
errstr = check_blockchain_from_bitcoincli(tmpctx, bitcoind, output, cmd);
|
||||
if (errstr)
|
||||
fatal("%s", errstr);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* bitcoin/src/rpc/protocol.h:
|
||||
* RPC_IN_WARMUP = -28, //!< Client still warming up
|
||||
|
||||
Reference in New Issue
Block a user