Browse Source

warnings: if behind blockchain, don't show cannot afford

If you're replaying or syncing with the blockchain, show that error
instead of 'cannot afford', in the case of not having enough utxos
to pay for a transaction. This is the 'more correct' error to show, as
there's a chance that the funds you're expecting to spend are in the
portion of the blockchain that hasn't been synced yet.
travis-debug
lisa neigut 5 years ago
committed by Christian Decker
parent
commit
f0f47ce153
  1. 7
      common/wallet_tx.c

7
common/wallet_tx.c

@ -107,9 +107,16 @@ static struct command_result *check_amount(const struct wallet_tx *wtx,
struct amount_sat amount)
{
if (tal_count(wtx->utxos) == 0) {
/* Since it's possible the lack of utxos is because we haven't finished
* syncing yet, report a sync timing error first */
if (!topology_synced(wtx->cmd->ld->topology))
return command_fail(wtx->cmd, FUNDING_STILL_SYNCING_BITCOIN,
"Still syncing with bitcoin network");
return command_fail(wtx->cmd, FUND_CANNOT_AFFORD,
"Cannot afford transaction");
}
if (amount_sat_less(amount, get_chainparams(wtx->cmd->ld)->dust_limit)) {
return command_fail(wtx->cmd, FUND_OUTPUT_IS_DUST,
"Output %s would be dust",

Loading…
Cancel
Save