Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,295 Lines • ▼ Show 20 Lines | if (fFirstRun) { | ||||
InitError(_("Unable to generate initial keys") += "\n"); | InitError(_("Unable to generate initial keys") += "\n"); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
walletInstance->ChainStateFlushed(chainActive.GetLocator()); | walletInstance->ChainStateFlushed(chainActive.GetLocator()); | ||||
} else if (gArgs.IsArgSet("-usehd")) { | } else if (gArgs.IsArgSet("-usehd")) { | ||||
bool useHD = gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET); | bool useHD = gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET); | ||||
if (walletInstance->IsHDEnabled() && !useHD) { | if (walletInstance->IsHDEnabled() && !useHD) { | ||||
InitError(strprintf(_("Error loading %s: You can't disable HD on a " | InitError( | ||||
strprintf(_("Error loading %s: You can't disable HD on an " | |||||
"already existing HD wallet"), | "already existing HD wallet"), | ||||
walletFile)); | walletFile)); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
if (!walletInstance->IsHDEnabled() && useHD) { | if (!walletInstance->IsHDEnabled() && useHD) { | ||||
InitError(strprintf(_("Error loading %s: You can't enable HD on a " | InitError(strprintf(_("Error loading %s: You can't enable HD on an " | ||||
"already existing non-HD wallet"), | "already existing non-HD wallet"), | ||||
walletFile)); | walletFile)); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); | LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); | ||||
Show All 11 Lines | if (!gArgs.GetBoolArg("-rescan", false)) { | ||||
} | } | ||||
} | } | ||||
walletInstance->m_last_block_processed = chainActive.Tip(); | walletInstance->m_last_block_processed = chainActive.Tip(); | ||||
RegisterValidationInterface(walletInstance); | RegisterValidationInterface(walletInstance); | ||||
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 an old wallet within a pruned node | ||||
// if he ran -disablewallet for a longer time, then decided to | // or if he ran -disablewallet for a longer time, then decided to | ||||
// re-enable. | // re-enable. | ||||
if (fPruneMode) { | if (fPruneMode) { | ||||
CBlockIndex *block = chainActive.Tip(); | CBlockIndex *block = chainActive.Tip(); | ||||
while (block && block->pprev && block->pprev->nStatus.hasData() && | while (block && block->pprev && block->pprev->nStatus.hasData() && | ||||
block->pprev->nTx > 0 && pindexRescan != block) { | block->pprev->nTx > 0 && pindexRescan != block) { | ||||
block = block->pprev; | block = block->pprev; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |