Browse Source

bitcoin: Make chainparams const

`cli` and `cli_args` were not `const` before since they are added to a
non-`const` array. Using `cast_const` we can keep them `const` without
unsafe cast.

Reported-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 8 years ago
parent
commit
2c0b52fb77
  1. 4
      bitcoin/chainparams.h
  2. 4
      daemon/bitcoind.c

4
bitcoin/chainparams.h

@ -11,8 +11,8 @@ struct chainparams {
const char *network_name;
const struct sha256_double genesis_blockhash;
const int rpc_port;
char *cli;
char *cli_args;
const char *cli;
const char *cli_args;
const u64 dust_limit;
/* Whether this is a test network or not */

4
daemon/bitcoind.c

@ -30,8 +30,8 @@ static char **gather_args(struct bitcoind *bitcoind,
size_t n = 0;
char **args = tal_arr(ctx, char *, 3);
args[n++] = bitcoind->chainparams->cli;
args[n++] = bitcoind->chainparams->cli_args;
args[n++] = cast_const(char *, bitcoind->chainparams->cli);
args[n++] = cast_const(char *, bitcoind->chainparams->cli_args);
if (bitcoind->datadir) {
args[n++] = tal_fmt(args, "-datadir=%s", bitcoind->datadir);

Loading…
Cancel
Save