Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 480 Lines • ▼ Show 20 Lines | for (MasterKeyMap::value_type &pMasterKey : mapMasterKeys) { | ||||
return true; | return true; | ||||
} | } | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
void CWallet::SetBestChain(const CBlockLocator &loc) { | void CWallet::ChainStateFlushed(const CBlockLocator &loc) { | ||||
CWalletDB walletdb(*dbw); | CWalletDB walletdb(*dbw); | ||||
walletdb.WriteBestBlock(loc); | walletdb.WriteBestBlock(loc); | ||||
} | } | ||||
bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB *pwalletdbIn, | bool CWallet::SetMinVersion(enum WalletFeature nVersion, CWalletDB *pwalletdbIn, | ||||
bool fExplicit) { | bool fExplicit) { | ||||
// nWalletVersion | // nWalletVersion | ||||
LOCK(cs_wallet); | LOCK(cs_wallet); | ||||
▲ Show 20 Lines • Show All 3,793 Lines • ▼ Show 20 Lines | if (fFirstRun) { | ||||
} | } | ||||
// Top up the keypool | // Top up the keypool | ||||
if (!walletInstance->TopUpKeyPool()) { | if (!walletInstance->TopUpKeyPool()) { | ||||
InitError(_("Unable to generate initial keys") += "\n"); | InitError(_("Unable to generate initial keys") += "\n"); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
walletInstance->SetBestChain(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 a " | ||||
"already existing HD wallet"), | "already existing HD wallet"), | ||||
walletFile)); | walletFile)); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | if (chainActive.Tip() && chainActive.Tip() != pindexRescan) { | ||||
InitError( | InitError( | ||||
_("Failed to rescan the wallet during initialization")); | _("Failed to rescan the wallet during initialization")); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
walletInstance->ScanForWalletTransactions(pindexRescan, nullptr, | walletInstance->ScanForWalletTransactions(pindexRescan, nullptr, | ||||
reserver, true); | reserver, true); | ||||
} | } | ||||
LogPrintf(" rescan %15dms\n", GetTimeMillis() - nStart); | LogPrintf(" rescan %15dms\n", GetTimeMillis() - nStart); | ||||
walletInstance->SetBestChain(chainActive.GetLocator()); | walletInstance->ChainStateFlushed(chainActive.GetLocator()); | ||||
walletInstance->dbw->IncrementUpdateCounter(); | walletInstance->dbw->IncrementUpdateCounter(); | ||||
// Restore wallet transaction metadata after -zapwallettxes=1 | // Restore wallet transaction metadata after -zapwallettxes=1 | ||||
if (gArgs.GetBoolArg("-zapwallettxes", false) && | if (gArgs.GetBoolArg("-zapwallettxes", false) && | ||||
gArgs.GetArg("-zapwallettxes", "1") != "2") { | gArgs.GetArg("-zapwallettxes", "1") != "2") { | ||||
CWalletDB walletdb(*walletInstance->dbw); | CWalletDB walletdb(*walletInstance->dbw); | ||||
for (const CWalletTx &wtxOld : vWtx) { | for (const CWalletTx &wtxOld : vWtx) { | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |