mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
daemon: add --bitcoin-datadir for bitcoin-cli.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ab0b9271f0
commit
8f2e66089b
@ -19,13 +19,21 @@
|
||||
|
||||
#define BITCOIN_CLI "bitcoin-cli"
|
||||
|
||||
char *bitcoin_datadir;
|
||||
|
||||
static char **gather_args(const tal_t *ctx, const char *cmd, va_list ap)
|
||||
{
|
||||
size_t n = 2;
|
||||
char **args = tal_arr(ctx, char *, n+1);
|
||||
size_t n = 0;
|
||||
char **args = tal_arr(ctx, char *, 1);
|
||||
|
||||
args[0] = BITCOIN_CLI;
|
||||
args[1] = cast_const(char *, cmd);
|
||||
args[n++] = BITCOIN_CLI;
|
||||
tal_resize(&args, n + 1);
|
||||
if (bitcoin_datadir) {
|
||||
args[n++] = tal_fmt(args, "-datadir=%s", bitcoin_datadir);
|
||||
tal_resize(&args, n + 1);
|
||||
}
|
||||
args[n++] = cast_const(char *, cmd);
|
||||
tal_resize(&args, n + 1);
|
||||
|
||||
while ((args[n] = va_arg(ap, char *)) != NULL) {
|
||||
args[n] = tal_strdup(args, args[n]);
|
||||
|
@ -10,6 +10,8 @@ struct lightningd_state;
|
||||
struct ripemd160;
|
||||
struct bitcoin_tx;
|
||||
struct peer;
|
||||
/* -datadir arg for bitcoin-cli. */
|
||||
extern char *bitcoin_datadir;
|
||||
|
||||
void bitcoind_watch_addr(struct lightningd_state *dstate,
|
||||
const struct ripemd160 *redeemhash);
|
||||
|
@ -213,6 +213,9 @@ int main(int argc, char *argv[])
|
||||
"Print this message.");
|
||||
opt_register_arg("--port", opt_set_uintval, NULL, &portnum,
|
||||
"Port to bind to (otherwise, dynamic port is used)");
|
||||
opt_register_arg("--bitcoin-datadir", opt_set_charp, NULL,
|
||||
&bitcoin_datadir,
|
||||
"-datadir arg for bitcoin-cli");
|
||||
opt_register_logging(dstate->base_log);
|
||||
opt_register_version();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user