mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-25 18:14:19 +01:00
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.
This commit is contained in:
committed by
Christian Decker
parent
7f45e55d84
commit
f0f47ce153
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user