channeld: Use the chainparams to check msatoshi and funding_satoshi

This commit is contained in:
Christian Decker
2018-09-06 18:50:09 +02:00
parent 2402c524cc
commit 0128bc7362
3 changed files with 8 additions and 6 deletions

View File

@@ -766,6 +766,7 @@ static void json_fund_channel(struct command *cmd,
struct channel *channel;
u32 *feerate_per_kw;
u8 *msg;
u64 max_funding_satoshi = get_chainparams(cmd->ld)->max_funding_satoshi;
fc->cmd = cmd;
fc->uc = NULL;
@@ -777,7 +778,7 @@ static void json_fund_channel(struct command *cmd,
NULL))
return;
if (!json_tok_wtx(&fc->wtx, buffer, sattok, MAX_FUNDING_SATOSHI))
if (!json_tok_wtx(&fc->wtx, buffer, sattok, max_funding_satoshi))
return;
if (!feerate_per_kw) {
@@ -820,7 +821,7 @@ static void json_fund_channel(struct command *cmd,
BITCOIN_SCRIPTPUBKEY_P2WSH_LEN))
return;
assert(fc->wtx.amount <= MAX_FUNDING_SATOSHI);
assert(fc->wtx.amount <= max_funding_satoshi);
peer->uncommitted_channel->fc = tal_steal(peer->uncommitted_channel, fc);
fc->uc = peer->uncommitted_channel;