Skip to content

Commit c988f27

Browse files
committed
Have UpgradeWallet take the version to upgrade to and an error message out parameter
1 parent 1833237 commit c988f27

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/wallet/wallet.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,7 +3831,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
38313831
}
38323832

38333833
if (gArgs.GetBoolArg("-upgradewallet", false)) {
3834-
if (!UpgradeWallet(walletInstance, error, warnings)) {
3834+
if (!UpgradeWallet(walletInstance, gArgs.GetBoolArg("-upgradewallet", 0), error, warnings)) {
38353835
return nullptr;
38363836
}
38373837
}
@@ -4097,10 +4097,10 @@ const CAddressBookData* CWallet::FindAddressBookEntry(const CTxDestination& dest
40974097
return &address_book_it->second;
40984098
}
40994099

4100-
bool CWallet::UpgradeWallet(std::shared_ptr<CWallet> walletInstance, std::string& error, std::vector<std::string>& warnings)
4100+
bool CWallet::UpgradeWallet(std::shared_ptr<CWallet> walletInstance, int version, std::string& error, std::vector<std::string>& warnings)
41014101
{
41024102
int prev_version = walletInstance->GetVersion();
4103-
int nMaxVersion = gArgs.GetArg("-upgradewallet", 0);
4103+
int nMaxVersion = version;
41044104
if (nMaxVersion == 0) // the -upgradewallet without argument case
41054105
{
41064106
walletInstance->WalletLogPrintf("Performing wallet upgrade to %i\n", FEATURE_LATEST);

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
11761176
};
11771177

11781178
/** Upgrade the wallet */
1179-
static bool UpgradeWallet(std::shared_ptr<CWallet> wallet, std::string& error, std::vector<std::string>& warnings);
1179+
static bool UpgradeWallet(std::shared_ptr<CWallet> wallet, int version, std::string& error, std::vector<std::string>& warnings);
11801180

11811181
//! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers
11821182
std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans() const;

0 commit comments

Comments
 (0)