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>
This commit is contained in:
Christian Decker 2017-07-13 15:36:50 +02:00
parent 5fdb8a58aa
commit 2c0b52fb77
2 changed files with 4 additions and 4 deletions

View File

@ -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 */

View File

@ -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);