Skip to content

Commit 1325cea

Browse files
committed
[Wallet] BugFix: automatic upgrade for unlocked wallet isn't upgrading the wallet feature version.
1 parent 8b04db1 commit 1325cea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ bool CWallet::ActivateSaplingWallet(bool memOnly)
8686
{
8787
if (m_sspk_man->SetupGeneration(m_spk_man->GetHDChain().GetID(), true, memOnly)) {
8888
LogPrintf("%s : sapling spkm setup completed\n", __func__);
89+
// Just to be triple sure, if the version isn't updated, set it.
90+
if (!SetMinVersion(WalletFeature::FEATURE_SAPLING)) {
91+
LogPrintf("%s : ERROR: wallet cannot upgrade to sapling features. Try to upgrade using the 'upgradewallet' RPC command\n", __func__);
92+
return false;
93+
}
8994
return true;
9095
}
9196
return false;
@@ -4002,7 +4007,8 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
40024007

40034008
// Forced upgrade
40044009
const bool fLegacyWallet = gArgs.GetBoolArg("-legacywallet", false);
4005-
if (gArgs.GetBoolArg("-upgradewallet", fFirstRun && !fLegacyWallet)) {
4010+
if (gArgs.GetBoolArg("-upgradewallet", fFirstRun && !fLegacyWallet) ||
4011+
(!walletInstance->IsLocked() && prev_version == FEATURE_PRE_SPLIT_KEYPOOL)) {
40064012
if (prev_version <= FEATURE_PRE_PIVX && walletInstance->IsLocked()) {
40074013
// Cannot upgrade a locked wallet
40084014
UIError("Cannot upgrade a locked wallet.");

0 commit comments

Comments
 (0)