Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,307 Lines • ▼ Show 20 Lines | if (!gArgs.GetBoolArg("-rescan", false)) { | ||||
rescan_height = *fork_height; | rescan_height = *fork_height; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
const Optional<int> tip_height = chain.getHeight(); | const Optional<int> tip_height = chain.getHeight(); | ||||
if (tip_height) { | if (tip_height) { | ||||
walletInstance->m_last_block_processed = | walletInstance->m_last_block_processed = | ||||
locked_chain->getBlockHash(*tip_height); | chain.getBlockHash(*tip_height); | ||||
walletInstance->m_last_block_processed_height = *tip_height; | walletInstance->m_last_block_processed_height = *tip_height; | ||||
} else { | } else { | ||||
walletInstance->m_last_block_processed.SetNull(); | walletInstance->m_last_block_processed.SetNull(); | ||||
walletInstance->m_last_block_processed_height = -1; | walletInstance->m_last_block_processed_height = -1; | ||||
} | } | ||||
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. | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (tip_height && *tip_height != rescan_height) { | ||||
} | } | ||||
{ | { | ||||
WalletRescanReserver reserver(*walletInstance); | WalletRescanReserver reserver(*walletInstance); | ||||
if (!reserver.reserve() || | if (!reserver.reserve() || | ||||
(ScanResult::SUCCESS != | (ScanResult::SUCCESS != | ||||
walletInstance | walletInstance | ||||
->ScanForWalletTransactions( | ->ScanForWalletTransactions( | ||||
locked_chain->getBlockHash(rescan_height), | chain.getBlockHash(rescan_height), rescan_height, | ||||
rescan_height, {} /* max height */, reserver, | {} /* max height */, reserver, true /* update */) | ||||
true /* update */) | |||||
.status)) { | .status)) { | ||||
error = _("Failed to rescan the wallet during initialization"); | error = _("Failed to rescan the wallet during initialization"); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
walletInstance->ChainStateFlushed(locked_chain->getTipLocator()); | walletInstance->ChainStateFlushed(locked_chain->getTipLocator()); | ||||
walletInstance->database->IncrementUpdateCounter(); | walletInstance->database->IncrementUpdateCounter(); | ||||
▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines |