From 8c00e4f98dd4a17942af9a1e36667ebd4a19c6fa Mon Sep 17 00:00:00 2001 From: Igor Cota Date: Sun, 25 Mar 2018 13:57:52 +0200 Subject: [PATCH] Add --bitcoin-rpcport option to pass to bitcoin-rpc --- lightningd/bitcoind.c | 5 +++++ lightningd/bitcoind.h | 2 +- lightningd/options.c | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lightningd/bitcoind.c b/lightningd/bitcoind.c index 08ea518b8..875b3657f 100644 --- a/lightningd/bitcoind.c +++ b/lightningd/bitcoind.c @@ -48,6 +48,10 @@ static const char **gather_args(const struct bitcoind *bitcoind, add_arg(&args, tal_fmt(args, "-rpcconnect=%s", bitcoind->rpcconnect)); + if (bitcoind->rpcport) + add_arg(&args, + tal_fmt(args, "-rpcport=%s", bitcoind->rpcport)); + if (bitcoind->rpcuser) add_arg(&args, tal_fmt(args, "-rpcuser=%s", bitcoind->rpcuser)); @@ -804,6 +808,7 @@ struct bitcoind *new_bitcoind(const tal_t *ctx, bitcoind->rpcuser = NULL; bitcoind->rpcpass = NULL; bitcoind->rpcconnect = NULL; + bitcoind->rpcport = NULL; list_head_init(&bitcoind->pending); tal_add_destructor(bitcoind, destroy_bitcoind); diff --git a/lightningd/bitcoind.h b/lightningd/bitcoind.h index afeb7b14b..dac577902 100644 --- a/lightningd/bitcoind.h +++ b/lightningd/bitcoind.h @@ -54,7 +54,7 @@ struct bitcoind { bool shutdown; /* Passthrough parameters for bitcoin-cli */ - char *rpcuser, *rpcpass, *rpcconnect; + char *rpcuser, *rpcpass, *rpcconnect, *rpcport; }; struct bitcoind *new_bitcoind(const tal_t *ctx, diff --git a/lightningd/options.c b/lightningd/options.c index def28964c..20f041fa7 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -648,6 +648,9 @@ void register_opts(struct lightningd *ld) opt_register_arg("--bitcoin-rpcconnect", opt_set_talstr, NULL, &ld->topology->bitcoind->rpcconnect, "bitcoind RPC host to connect to"); + opt_register_arg("--bitcoin-rpcport", opt_set_talstr, NULL, + &ld->topology->bitcoind->rpcport, + "bitcoind RPC port"); opt_register_arg("--pid-file=", opt_set_talstr, opt_show_charp, &ld->pidfile, "Specify pid file");