mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-02 00:38:15 +01:00
Have UpgradeWallet take the version to upgrade to and an error message out parameter
This commit is contained in:
@@ -3831,7 +3831,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(interfaces::Chain& chain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gArgs.GetBoolArg("-upgradewallet", false)) {
|
if (gArgs.GetBoolArg("-upgradewallet", false)) {
|
||||||
if (!UpgradeWallet(walletInstance, error, warnings)) {
|
if (!UpgradeWallet(walletInstance, gArgs.GetBoolArg("-upgradewallet", 0), error, warnings)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4097,10 +4097,10 @@ const CAddressBookData* CWallet::FindAddressBookEntry(const CTxDestination& dest
|
|||||||
return &address_book_it->second;
|
return &address_book_it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::UpgradeWallet(std::shared_ptr<CWallet> walletInstance, std::string& error, std::vector<std::string>& warnings)
|
bool CWallet::UpgradeWallet(std::shared_ptr<CWallet> walletInstance, int version, std::string& error, std::vector<std::string>& warnings)
|
||||||
{
|
{
|
||||||
int prev_version = walletInstance->GetVersion();
|
int prev_version = walletInstance->GetVersion();
|
||||||
int nMaxVersion = gArgs.GetArg("-upgradewallet", 0);
|
int nMaxVersion = version;
|
||||||
if (nMaxVersion == 0) // the -upgradewallet without argument case
|
if (nMaxVersion == 0) // the -upgradewallet without argument case
|
||||||
{
|
{
|
||||||
walletInstance->WalletLogPrintf("Performing wallet upgrade to %i\n", FEATURE_LATEST);
|
walletInstance->WalletLogPrintf("Performing wallet upgrade to %i\n", FEATURE_LATEST);
|
||||||
|
|||||||
@@ -1176,7 +1176,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Upgrade the wallet */
|
/** Upgrade the wallet */
|
||||||
static bool UpgradeWallet(std::shared_ptr<CWallet> wallet, std::string& error, std::vector<std::string>& warnings);
|
static bool UpgradeWallet(std::shared_ptr<CWallet> wallet, int version, std::string& error, std::vector<std::string>& warnings);
|
||||||
|
|
||||||
//! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers
|
//! Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers
|
||||||
std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans() const;
|
std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user