Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,140 Lines • ▼ Show 20 Lines | if (nLoadWalletRet != DBErrors::LOAD_OK) { | ||||
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 (gArgs.GetBoolArg("-upgradewallet", false)) { | ||||
if (!UpgradeWallet(walletInstance, error, warnings)) { | if (!UpgradeWallet(walletInstance, gArgs.GetArg("-upgradewallet", 0), | ||||
error, warnings)) { | |||||
return nullptr; | 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); | ||||
▲ Show 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | CWallet::FindAddressBookEntry(const CTxDestination &dest, | ||||
} | } | ||||
if ((!allow_change) && address_book_it->second.IsChange()) { | if ((!allow_change) && address_book_it->second.IsChange()) { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
return &address_book_it->second; | return &address_book_it->second; | ||||
} | } | ||||
bool CWallet::UpgradeWallet(std::shared_ptr<CWallet> walletInstance, | bool CWallet::UpgradeWallet(std::shared_ptr<CWallet> walletInstance, | ||||
bilingual_str &error, | int version, bilingual_str &error, | ||||
std::vector<bilingual_str> &warnings) { | std::vector<bilingual_str> &warnings) { | ||||
int prev_version = walletInstance->GetVersion(); | int prev_version = walletInstance->GetVersion(); | ||||
int nMaxVersion = gArgs.GetArg("-upgradewallet", 0); | int nMaxVersion = version; | ||||
// The -upgradewallet without argument case | // The -upgradewallet without argument case | ||||
if (nMaxVersion == 0) { | if (nMaxVersion == 0) { | ||||
walletInstance->WalletLogPrintf("Performing wallet upgrade to %i\n", | walletInstance->WalletLogPrintf("Performing wallet upgrade to %i\n", | ||||
FEATURE_LATEST); | FEATURE_LATEST); | ||||
nMaxVersion = FEATURE_LATEST; | nMaxVersion = FEATURE_LATEST; | ||||
// permanently upgrade the wallet immediately | // permanently upgrade the wallet immediately | ||||
walletInstance->SetMinVersion(FEATURE_LATEST); | walletInstance->SetMinVersion(FEATURE_LATEST); | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 308 Lines • Show Last 20 Lines |