Skip to content

Commit f7c3f24

Browse files
plugin-bcli: added rpcwaittimeout
Changelog-None Signed-off-by: Nishant Bansal <[email protected]>
1 parent 4f307a7 commit f7c3f24

File tree

3 files changed

+7
-15
lines changed

3 files changed

+7
-15
lines changed

cln-rpc/src/codec.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ impl Decoder for JsonCodec {
105105
/// A codec that reads fully formed [crate::messages::JsonRpc]
106106
/// messages. Internally it uses the [JsonCodec] which itself is built
107107
/// on the [MultiLineCodec].
108-
#[allow(dead_code)]
109108
#[derive(Default)]
110109
pub(crate) struct JsonRpcCodec {
111110
inner: JsonCodec,

plugins/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ PLUGIN_COMMON_OBJS := \
192192
common/splice_script.o \
193193
common/setup.o \
194194
common/status_levels.o \
195-
common/timeout.o \
196195
common/utils.o \
197196
common/version.o \
198197
common/wireaddr.o \

plugins/bcli.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <common/json_param.h>
1111
#include <common/json_stream.h>
1212
#include <common/memleak.h>
13-
#include <common/timeout.h>
1413
#include <errno.h>
1514
#include <plugins/libplugin.h>
1615

@@ -102,7 +101,6 @@ static const char **gather_argsv(const tal_t *ctx, const char *cmd, va_list ap)
102101
const char *arg;
103102

104103
args[0] = bitcoind->cli ? bitcoind->cli : chainparams->cli;
105-
106104
if (chainparams->cli_args)
107105
add_arg(&args, chainparams->cli_args);
108106
if (bitcoind->datadir)
@@ -1035,23 +1033,14 @@ static void parse_getnetworkinfo_result(struct plugin *p, const char *buf)
10351033
tal_free(result);
10361034
}
10371035

1038-
static void log_warm_up(struct plugin *p)
1039-
{
1040-
plugin_log(p, LOG_UNUSUAL, "Waiting for bitcoind to warm up...");
1041-
}
1042-
10431036
static void wait_and_check_bitcoind(struct plugin *p)
10441037
{
10451038
int in, from, status;
10461039
pid_t child;
1047-
const char **cmd =
1048-
gather_args(bitcoind, "-rpcwait", "getnetworkinfo", NULL);
1040+
const char **cmd = gather_args(
1041+
bitcoind, "-rpcwait", "-rpcwaittimeout=30", "getnetworkinfo", NULL);
10491042
char *output = NULL;
10501043

1051-
struct timers *timer = tal(cmd, struct timers);
1052-
timers_init(timer, time_mono());
1053-
new_reltimer(timer, timer, time_from_sec(30), log_warm_up, p);
1054-
10551044
child = pipecmdarr(&in, &from, &from, cast_const2(char **, cmd));
10561045

10571046
if (bitcoind->rpcpass)
@@ -1077,6 +1066,11 @@ static void wait_and_check_bitcoind(struct plugin *p)
10771066
cmd[0], WTERMSIG(status)));
10781067

10791068
if (WEXITSTATUS(status) != 0) {
1069+
if (WEXITSTATUS(status) == 1)
1070+
bitcoind_failure(p,
1071+
"RPC connection timed out. Could "
1072+
"not connect to bitcoind using "
1073+
"bitcoin-cli. Is bitcoind running?");
10801074
bitcoind_failure(p,
10811075
tal_fmt(bitcoind, "%s exited with code %i: %s",
10821076
cmd[0], WEXITSTATUS(status), output));

0 commit comments

Comments
 (0)