withdraw: fix incorrect error when we have an empty wallet.

This also highlights the danger of searching the logs: that error
appeared previously in the logs, so we didn't notice that the actual
withdraw call gave a different error.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-10-19 11:47:44 +10:30
parent f583e6bc58
commit 71a40faae7
3 changed files with 6 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ void wtx_init(struct command *cmd, struct wallet_tx * wtx)
static bool check_amount(const struct wallet_tx *tx, u64 amount)
{
if (!tx->utxos) {
if (tal_count(tx->utxos) == 0) {
command_fail(tx->cmd, FUND_CANNOT_AFFORD,
"Cannot afford transaction");
return false;