Browse Source

fundchannel: only cap to 'max' if keyword 'all' passed in

in order to preserve current behavior, we cap at max if specified 'all';
otherwise we fail since the amount requested is larger than the
channel max capacity
travis-debug
lisa neigut 5 years ago
committed by Rusty Russell
parent
commit
7d069239aa
  1. 5
      plugins/fundchannel.c

5
plugins/fundchannel.c

@ -20,6 +20,7 @@ struct funding_req {
const char *feerate_str;
const char *funding_str;
const char *utxo_str;
bool funding_all;
bool *announce_channel;
u32 *minconf;
@ -363,7 +364,7 @@ static struct command_result *tx_prepare_dryrun(struct command *cmd,
plugin_err("Error creating placebo funding tx, funding_out not found. %s", hex);
/* Update funding to actual amount */
if (amount_sat_greater(funding, max_funding))
if (fr->funding_all && amount_sat_greater(funding, max_funding))
funding = max_funding;
fr->funding_str = type_to_string(fr, struct amount_sat, &funding);
@ -387,6 +388,8 @@ static struct command_result *json_fundchannel(struct command *cmd,
NULL))
return NULL;
fr->funding_all = streq(fr->funding_str, "all");
/* First we do a 'dry-run' of txprepare, so we can get
* an accurate idea of the funding amount */
ret = txprepare(cmd, fr, placeholder_funding_addr);

Loading…
Cancel
Save