wallet: have prune error take precedence over assumedvalid

From Russ Yanofsky:

"Agree with all of Marco's points here and think this should be updated

If havePrune and hasAssumedValidChain are both true, better to show
havePrune error message.  Assumed-valid error message is vague and not
very actionable.  Would suggest "Error loading wallet. Wallet requires
blocks to be downloaded, and software does not currently support loading
wallets while blocks are being downloaded out of order though assumeutxo
snapshots. Wallet should be able to load successfully after node sync
reaches height {block_height}"

Co-authored-by: MacroFake <MarcoFalke@gmail.com>
Co-authored-by: Russ Yanofsky <russ@yanofsky.org>
This commit is contained in:
James O'Beirne 2022-10-07 15:08:32 -04:00
parent 73b61717a9
commit 1c36bafc5f
No known key found for this signature in database
GPG Key ID: 7A935DADB2C44F05

View File

@ -3111,12 +3111,14 @@ bool CWallet::AttachChain(const std::shared_ptr<CWallet>& walletInstance, interf
// If a block is pruned after this check, we will load the wallet,
// but fail the rescan with a generic error.
error = chain.hasAssumedValidChain() ?
_(
"Assumed-valid: last wallet synchronisation goes beyond "
"available block data. You need to wait for the background "
"validation chain to download more blocks.") :
_("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)");
error = chain.havePruned() ?
_("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)") :
strprintf(_(
"Error loading wallet. Wallet requires blocks to be downloaded, "
"and software does not currently support loading wallets while "
"blocks are being downloaded out of order when using assumeutxo "
"snapshots. Wallet should be able to load successfully after "
"node sync reaches height %s"), block_height);
return false;
}
}