diff --git a/lightningd/bitcoind.c b/lightningd/bitcoind.c index eba3512d2..cd57af75f 100644 --- a/lightningd/bitcoind.c +++ b/lightningd/bitcoind.c @@ -42,6 +42,22 @@ static char **gather_args(const struct bitcoind *bitcoind, args[n++] = tal_fmt(args, "-datadir=%s", bitcoind->datadir); tal_resize(&args, n + 1); } + + if (bitcoind->rpcconnect) { + args[n++] = tal_fmt(args, "-rpcconnect=%s", bitcoind->rpcconnect); + tal_resize(&args, n + 1); + } + + if (bitcoind->rpcuser) { + args[n++] = tal_fmt(args, "-rpcuser=%s", bitcoind->rpcuser); + tal_resize(&args, n + 1); + } + + if (bitcoind->rpcpass) { + args[n++] = tal_fmt(args, "-rpcpassword=%s", bitcoind->rpcpass); + tal_resize(&args, n + 1); + } + args[n++] = cast_const(char *, cmd); tal_resize(&args, n + 1); @@ -716,6 +732,9 @@ struct bitcoind *new_bitcoind(const tal_t *ctx, bitcoind->req_running = false; bitcoind->shutdown = false; bitcoind->error_count = 0; + bitcoind->rpcuser = NULL; + bitcoind->rpcpass = NULL; + bitcoind->rpcconnect = NULL; list_head_init(&bitcoind->pending); tal_add_destructor(bitcoind, destroy_bitcoind); diff --git a/lightningd/bitcoind.h b/lightningd/bitcoind.h index 363ea6dfa..d6e3fdbce 100644 --- a/lightningd/bitcoind.h +++ b/lightningd/bitcoind.h @@ -49,6 +49,9 @@ struct bitcoind { /* Ignore results, we're shutting down. */ bool shutdown; + + /* Passthrough parameters for bitcoin-cli */ + char *rpcuser, *rpcpass, *rpcconnect; }; struct bitcoind *new_bitcoind(const tal_t *ctx, diff --git a/lightningd/options.c b/lightningd/options.c index 3862ee699..7fa60972d 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -548,6 +548,16 @@ void register_opts(struct lightningd *ld) opt_register_arg("--alias", opt_set_alias, NULL, ld, "Up to 32-byte alias for node"); + opt_register_arg("--bitcoin-rpcuser", opt_set_talstr, NULL, + &ld->topology->bitcoind->rpcuser, + "bitcoind RPC username"); + opt_register_arg("--bitcoin-rpcpassword", opt_set_talstr, NULL, + &ld->topology->bitcoind->rpcpass, + "bitcoind RPC password"); + opt_register_arg("--bitcoin-rpcconnect", opt_set_talstr, NULL, + &ld->topology->bitcoind->rpcconnect, + "bitcoind RPC host to connect to"); + opt_register_arg( "--channel-update-interval=", opt_set_u32, opt_show_u32, &ld->config.channel_update_interval,