From c988f27937bc79c90f4eed48552c72f1b66dc044 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 22 Apr 2019 00:18:35 -0400 Subject: Have UpgradeWallet take the version to upgrade to and an error message out parameter --- src/wallet/wallet.cpp | 6 +++--- src/wallet/wallet.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/wallet') diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 83c35befd9..a6cd543205 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3831,7 +3831,7 @@ std::shared_ptr CWallet::CreateWalletFromFile(interfaces::Chain& chain, } if (gArgs.GetBoolArg("-upgradewallet", false)) { - if (!UpgradeWallet(walletInstance, error, warnings)) { + if (!UpgradeWallet(walletInstance, gArgs.GetBoolArg("-upgradewallet", 0), error, warnings)) { return nullptr; } } @@ -4097,10 +4097,10 @@ const CAddressBookData* CWallet::FindAddressBookEntry(const CTxDestination& dest return &address_book_it->second; } -bool CWallet::UpgradeWallet(std::shared_ptr walletInstance, std::string& error, std::vector& warnings) +bool CWallet::UpgradeWallet(std::shared_ptr walletInstance, int version, std::string& error, std::vector& warnings) { int prev_version = walletInstance->GetVersion(); - int nMaxVersion = gArgs.GetArg("-upgradewallet", 0); + int nMaxVersion = version; if (nMaxVersion == 0) // the -upgradewallet without argument case { walletInstance->WalletLogPrintf("Performing wallet upgrade to %i\n", FEATURE_LATEST); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 669e3a33f2..a4787a8b21 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -1176,7 +1176,7 @@ public: }; /** Upgrade the wallet */ - static bool UpgradeWallet(std::shared_ptr wallet, std::string& error, std::vector& warnings); + static bool UpgradeWallet(std::shared_ptr wallet, int version, std::string& error, std::vector& warnings); //! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers std::set GetActiveScriptPubKeyMans() const; -- cgit v1.2.3