* Funding channel with "all"
* Added test for fund all
This commit is contained in:
Mark Beckwith
2018-03-20 18:06:04 -05:00
committed by Christian Decker
parent 5737853123
commit 489d8d04a6
3 changed files with 63 additions and 23 deletions

View File

@@ -91,7 +91,7 @@ static void json_withdraw(struct command *cmd,
u32 feerate_per_kw = get_feerate(cmd->ld->topology, FEERATE_NORMAL);
u64 fee_estimate;
struct bitcoin_tx *tx;
bool withdraw_all = false;
bool all_funds = false;
enum address_parse_result addr_parse;
if (!json_get_params(cmd, buffer, params,
@@ -105,7 +105,7 @@ static void json_withdraw(struct command *cmd,
withdraw->cmd = cmd;
if (json_tok_streq(buffer, sattok, "all"))
withdraw_all = true;
all_funds = true;
else if (!json_tok_u64(buffer, sattok, &withdraw->amount)) {
command_fail(cmd, "Invalid satoshis");
return;
@@ -132,7 +132,7 @@ static void json_withdraw(struct command *cmd,
}
/* Select the coins */
if (withdraw_all) {
if (all_funds) {
withdraw->utxos = wallet_select_all(cmd, cmd->ld->wallet,
feerate_per_kw,
tal_len(withdraw->destination),