lightningd: add --bitcoin-cli arg for testing.

And remove unused bitcoin_datadir and BITCOIN_CLI.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2018-02-24 15:43:34 +10:30 committed by Christian Decker
parent f0a12c5c23
commit 50171d3e1a
3 changed files with 8 additions and 5 deletions

View file

@ -22,10 +22,6 @@
#include <inttypes.h>
#include <lightningd/chaintopology.h>
#define BITCOIN_CLI "bitcoin-cli"
char *bitcoin_datadir;
/* Add the n'th arg to *args, incrementing n and keeping args of size n+1 */
static void add_arg(const char ***args, const char *arg)
{
@ -40,7 +36,7 @@ static const char **gather_args(const struct bitcoind *bitcoind,
const char **args = tal_arr(ctx, const char *, 1);
const char *arg;
args[0] = bitcoind->chainparams->cli;
args[0] = bitcoind->cli ? bitcoind->cli : bitcoind->chainparams->cli;
if (bitcoind->chainparams->cli_args)
add_arg(&args, bitcoind->chainparams->cli_args);
@ -773,6 +769,7 @@ struct bitcoind *new_bitcoind(const tal_t *ctx,
/* Use testnet by default, change later if we want another network */
bitcoind->chainparams = chainparams_for_network("testnet");
bitcoind->cli = NULL;
bitcoind->datadir = NULL;
bitcoind->ld = ld;
bitcoind->log = log;

View file

@ -25,6 +25,9 @@ enum bitcoind_mode {
};
struct bitcoind {
/* eg. "bitcoin-cli" */
char *cli;
/* -datadir arg for bitcoin-cli. */
char *datadir;

View file

@ -562,6 +562,9 @@ 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-cli", opt_set_talstr, NULL,
&ld->topology->bitcoind->cli,
"bitcoin-cli pathname");
opt_register_arg("--bitcoin-rpcuser", opt_set_talstr, NULL,
&ld->topology->bitcoind->rpcuser,
"bitcoind RPC username");