Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,249 Lines • ▼ Show 20 Lines | if (tip_height && *tip_height != rescan_height) { | ||||
chain.initMessage(_("Rescanning...").translated); | chain.initMessage(_("Rescanning...").translated); | ||||
walletInstance->WalletLogPrintf( | walletInstance->WalletLogPrintf( | ||||
"Rescanning last %i blocks (from block %i)...\n", | "Rescanning last %i blocks (from block %i)...\n", | ||||
*tip_height - rescan_height, rescan_height); | *tip_height - rescan_height, rescan_height); | ||||
// No need to read and scan block if block was created before our wallet | // No need to read and scan block if block was created before our wallet | ||||
// birthday (as adjusted for block time variability) | // birthday (as adjusted for block time variability) | ||||
if (walletInstance->nTimeFirstKey) { | Optional<int64_t> time_first_key; | ||||
if (auto spk_man = walletInstance->m_spk_man.get()) { | |||||
int64_t time = spk_man->GetTimeFirstKey(); | |||||
if (!time_first_key || time < *time_first_key) { | |||||
time_first_key = time; | |||||
} | |||||
} | |||||
if (time_first_key) { | |||||
if (Optional<int> first_block = | if (Optional<int> first_block = | ||||
locked_chain->findFirstBlockWithTimeAndHeight( | locked_chain->findFirstBlockWithTimeAndHeight( | ||||
walletInstance->nTimeFirstKey - TIMESTAMP_WINDOW, | *time_first_key - TIMESTAMP_WINDOW, rescan_height, | ||||
rescan_height, nullptr)) { | nullptr)) { | ||||
rescan_height = *first_block; | rescan_height = *first_block; | ||||
} | } | ||||
} | } | ||||
{ | { | ||||
WalletRescanReserver reserver(walletInstance.get()); | WalletRescanReserver reserver(walletInstance.get()); | ||||
if (!reserver.reserve() || | if (!reserver.reserve() || | ||||
(ScanResult::SUCCESS != | (ScanResult::SUCCESS != | ||||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |