mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
lightningd: don't use chainparams before param() call in json_fund_channel_start
With coming changes, this will segfault if we access it when param code is trying to get usage from functions. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
34c89cb226
commit
5673607ebc
@ -1105,9 +1105,8 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
|
|||||||
u32 *feerate_per_kw;
|
u32 *feerate_per_kw;
|
||||||
|
|
||||||
u8 *msg = NULL;
|
u8 *msg = NULL;
|
||||||
struct amount_sat max_funding_satoshi, *amount;
|
struct amount_sat *amount;
|
||||||
|
|
||||||
max_funding_satoshi = chainparams->max_funding;
|
|
||||||
fc->cmd = cmd;
|
fc->cmd = cmd;
|
||||||
fc->cancels = tal_arr(fc, struct command *, 0);
|
fc->cancels = tal_arr(fc, struct command *, 0);
|
||||||
fc->uc = NULL;
|
fc->uc = NULL;
|
||||||
@ -1149,11 +1148,11 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
|
|||||||
fc->our_upfront_shutdown_script = NULL;
|
fc->our_upfront_shutdown_script = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (amount_sat_greater(*amount, max_funding_satoshi))
|
if (amount_sat_greater(*amount, chainparams->max_funding))
|
||||||
return command_fail(cmd, FUND_MAX_EXCEEDED,
|
return command_fail(cmd, FUND_MAX_EXCEEDED,
|
||||||
"Amount exceeded %s",
|
"Amount exceeded %s",
|
||||||
type_to_string(tmpctx, struct amount_sat,
|
type_to_string(tmpctx, struct amount_sat,
|
||||||
&max_funding_satoshi));
|
&chainparams->max_funding));
|
||||||
|
|
||||||
fc->funding = *amount;
|
fc->funding = *amount;
|
||||||
if (!feerate_per_kw) {
|
if (!feerate_per_kw) {
|
||||||
@ -1203,7 +1202,7 @@ static struct command_result *json_fund_channel_start(struct command *cmd,
|
|||||||
type_to_string(fc, struct node_id, id));
|
type_to_string(fc, struct node_id, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!amount_sat_greater(*amount, max_funding_satoshi));
|
assert(!amount_sat_greater(*amount, chainparams->max_funding));
|
||||||
peer->uncommitted_channel->fc = tal_steal(peer->uncommitted_channel, fc);
|
peer->uncommitted_channel->fc = tal_steal(peer->uncommitted_channel, fc);
|
||||||
fc->uc = peer->uncommitted_channel;
|
fc->uc = peer->uncommitted_channel;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user