Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions plugins/bcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,11 +780,21 @@ static void wait_and_check_bitcoind(struct plugin *p)
{
struct bcli_result *res;
const char **cmd;
int i;

/* Special case: -rpcwait flags go on command line, not stdin */
cmd = gather_args(bitcoind, NULL, "-rpcwait", "-rpcwaittimeout=30",
/* We try 30 times one second rather than one time one second, because
we have seen cases bitcoind becomes available, but rpcwait still just hang
needlessly. */
cmd = gather_args(bitcoind, NULL, "-rpcwait", "-rpcwaittimeout=1",
"getnetworkinfo", NULL);
res = execute_bitcoin_cli(bitcoind, p, cmd, NULL);
for (i = 0; i < 30; i++) {
res = execute_bitcoin_cli(bitcoind, p, cmd, NULL);
if (res->exitstatus != 1)
break;
if (i != 29)
tal_free(res);
}

if (res->exitstatus == 1)
bitcoind_failure(p,
Expand Down
Loading