Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,168 Lines • ▼ Show 20 Lines | if (fFirstRun) { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); | LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); | ||||
RegisterValidationInterface(walletInstance); | RegisterValidationInterface(walletInstance); | ||||
CBlockIndex *pindexRescan = chainActive.Tip(); | CBlockIndex *pindexRescan = chainActive.Genesis(); | ||||
if (gArgs.GetBoolArg("-rescan", false)) { | if (!gArgs.GetBoolArg("-rescan", false)) { | ||||
pindexRescan = chainActive.Genesis(); | |||||
} else { | |||||
CWalletDB walletdb(*walletInstance->dbw); | CWalletDB walletdb(*walletInstance->dbw); | ||||
CBlockLocator locator; | CBlockLocator locator; | ||||
if (walletdb.ReadBestBlock(locator)) { | if (walletdb.ReadBestBlock(locator)) { | ||||
pindexRescan = FindForkInGlobalIndex(chainActive, locator); | pindexRescan = FindForkInGlobalIndex(chainActive, locator); | ||||
} else { | |||||
pindexRescan = chainActive.Genesis(); | |||||
} | } | ||||
} | } | ||||
if (chainActive.Tip() && chainActive.Tip() != pindexRescan) { | if (chainActive.Tip() && chainActive.Tip() != pindexRescan) { | ||||
// 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 a old wallet within a pruned node or | // This might happen if a user uses a old wallet within a pruned node or | ||||
// if he ran -disablewallet for a longer time, then decided to | // if he ran -disablewallet for a longer time, then decided to | ||||
// re-enable. | // re-enable. | ||||
▲ Show 20 Lines • Show All 317 Lines • Show Last 20 Lines |