You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
817326a wallet: avoid rescans if under the snapshot (James O'Beirne)
Pull request description:
This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11) (parent PR: #15606)
---
Refuse to load a wallet if it requires a rescan lower than the height of assumed-valid blocks.
Of course in live code right now, `BLOCK_ASSUMED_VALID` block index entries don't exist since they're a unique flag introduced by the use of UTXO snapshots, so this is prophylactic code exercised only by unittests.
ACKs for top commit:
achow101:
ACK 817326a
ryanofsky:
Code review ACK 817326a. This seems like the simplest change we can make to avoid wallet problems when an assumeutxo snapshot is loaded.
Tree-SHA512: cfa44b2eb33d1818d30df45210d0dde1e9b78cc9b7c88cb985054dc28427bba9e0905debe4196065d1d3a5ce7bca7e605e629d5ce5f0225b25395746e6d3d596
// We can't rescan beyond non-pruned blocks, stop and throw an error.
3062
+
// We can't rescan beyond blocks we don't have data for, stop and throw an error.
3060
3063
// This might happen if a user uses an old wallet within a pruned node
3061
3064
// or if they ran -disablewallet for a longer time, then decided to re-enable
3062
3065
// Exit early and print an error.
3066
+
// It also may happen if an assumed-valid chain is in use and therefore not
3067
+
// all block data is available.
3063
3068
// If a block is pruned after this check, we will load the wallet,
3064
3069
// but fail the rescan with a generic error.
3065
-
error = _("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)");
3070
+
3071
+
error = chain.hasAssumedValidChain() ?
3072
+
_(
3073
+
"Assumed-valid: last wallet synchronisation goes beyond "
3074
+
"available block data. You need to wait for the background "
3075
+
"validation chain to download more blocks.") :
3076
+
_("Prune: last wallet synchronisation goes beyond pruned data. You need to -reindex (download the whole blockchain again in case of pruned node)");
0 commit comments