Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,139 Lines • ▼ Show 20 Lines | if (nLoadWalletRet != DBErrors::LOAD_OK) { | ||||
PACKAGE_NAME); | PACKAGE_NAME); | ||||
return nullptr; | return nullptr; | ||||
} else { | } else { | ||||
error = strprintf(_("Error loading %s"), walletFile); | error = strprintf(_("Error loading %s"), walletFile); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
if (gArgs.GetBoolArg("-upgradewallet", false)) { | |||||
if (!walletInstance->UpgradeWallet(gArgs.GetArg("-upgradewallet", 0), | |||||
error, warnings)) { | |||||
return nullptr; | |||||
} | |||||
} | |||||
if (fFirstRun) { | if (fFirstRun) { | ||||
// Ensure this wallet.dat can only be opened by clients supporting | // Ensure this wallet.dat can only be opened by clients supporting | ||||
// HD with chain split and expects no default key. | // HD with chain split and expects no default key. | ||||
walletInstance->SetMinVersion(FEATURE_LATEST); | walletInstance->SetMinVersion(FEATURE_LATEST); | ||||
walletInstance->SetWalletFlags(wallet_creation_flags, false); | walletInstance->SetWalletFlags(wallet_creation_flags, false); | ||||
// Always create LegacyScriptPubKeyMan for now | // Always create LegacyScriptPubKeyMan for now | ||||
▲ Show 20 Lines • Show All 320 Lines • ▼ Show 20 Lines | bool CWallet::UpgradeWallet(int version, bilingual_str &error, | ||||
// Do not upgrade versions to any version between HD_SPLIT and | // Do not upgrade versions to any version between HD_SPLIT and | ||||
// FEATURE_PRE_SPLIT_KEYPOOL unless already supporting HD_SPLIT | // FEATURE_PRE_SPLIT_KEYPOOL unless already supporting HD_SPLIT | ||||
int max_version = GetVersion(); | int max_version = GetVersion(); | ||||
if (!CanSupportFeature(FEATURE_HD_SPLIT) && | if (!CanSupportFeature(FEATURE_HD_SPLIT) && | ||||
max_version >= FEATURE_HD_SPLIT && | max_version >= FEATURE_HD_SPLIT && | ||||
max_version < FEATURE_PRE_SPLIT_KEYPOOL) { | max_version < FEATURE_PRE_SPLIT_KEYPOOL) { | ||||
error = _("Cannot upgrade a non HD split wallet without upgrading to " | error = _("Cannot upgrade a non HD split wallet without upgrading to " | ||||
"support pre split keypool. Please use -upgradewallet=200300 " | "support pre split keypool. Please use version 200300 or no " | ||||
"or -upgradewallet with no version specified."); | "version specified."); | ||||
return false; | return false; | ||||
} | } | ||||
for (auto spk_man : GetActiveScriptPubKeyMans()) { | for (auto spk_man : GetActiveScriptPubKeyMans()) { | ||||
if (!spk_man->Upgrade(prev_version, error)) { | if (!spk_man->Upgrade(prev_version, error)) { | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 278 Lines • Show Last 20 Lines |