Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 5,003 Lines • ▼ Show 20 Lines | if (tip_height) { | ||||
locked_chain->getBlockHash(*tip_height); | locked_chain->getBlockHash(*tip_height); | ||||
} else { | } else { | ||||
walletInstance->m_last_block_processed.SetNull(); | walletInstance->m_last_block_processed.SetNull(); | ||||
} | } | ||||
if (tip_height && *tip_height != rescan_height) { | if (tip_height && *tip_height != rescan_height) { | ||||
// We can't rescan beyond non-pruned blocks, stop and throw an error. | // We can't rescan beyond non-pruned blocks, stop and throw an error. | ||||
// This might happen if a user uses an old wallet within a pruned node | // This might happen if a user uses an old wallet within a pruned node | ||||
// or if he ran -disablewallet for a longer time, then decided to | // or if they ran -disablewallet for a longer time, then decided to | ||||
// re-enable. | // re-enable | ||||
if (chain.getPruneMode()) { | if (chain.havePruned()) { | ||||
// Exit early and print an error. | |||||
// If a block is pruned after this check, we will load the wallet, | |||||
// but fail the rescan with a generic error. | |||||
int block_height = *tip_height; | int block_height = *tip_height; | ||||
while (block_height > 0 && | while (block_height > 0 && | ||||
locked_chain->haveBlockOnDisk(block_height - 1) && | locked_chain->haveBlockOnDisk(block_height - 1) && | ||||
rescan_height != block_height) { | rescan_height != block_height) { | ||||
--block_height; | --block_height; | ||||
} | } | ||||
if (rescan_height != block_height) { | if (rescan_height != block_height) { | ||||
▲ Show 20 Lines • Show All 431 Lines • Show Last 20 Lines |