walletdb: fix last client version update

The value was only being updated launching releases with higher version numbers
and not if the user launched a previous release.

Co-authored-by: MacroFake <falke.marco@gmail.com>
This commit is contained in:
furszy
2022-06-16 15:30:37 -03:00
parent bda8ebe608
commit c318211ddd

View File

@ -883,7 +883,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
if (result != DBErrors::LOAD_OK)
return result;
// Last client version to open this wallet, was previously the file version number
// Last client version to open this wallet
int last_client = CLIENT_VERSION;
bool has_last_client = m_batch->Read(DBKeys::VERSION, last_client);
pwallet->WalletLogPrintf("Wallet file version = %d, last client version = %d\n", pwallet->GetVersion(), last_client);
@ -907,7 +907,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
if (wss.fIsEncrypted && (last_client == 40000 || last_client == 50000))
return DBErrors::NEED_REWRITE;
if (!has_last_client || last_client < CLIENT_VERSION) // Update
if (!has_last_client || last_client != CLIENT_VERSION) // Update
m_batch->Write(DBKeys::VERSION, CLIENT_VERSION);
if (wss.fAnyUnordered)