Skip to content

Commit 359ecd3

Browse files
committed
walletdb: Log the wallet version after it has been read from disk
Logging the wallet version before anything has been read from disk results in the wrong version being logged. Also split the last client version logging as it may not always be present to be logged.
1 parent 7710a31 commit 359ecd3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wallet/walletdb.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ static DBErrors LoadMinVersion(CWallet* pwallet, DatabaseBatch& batch) EXCLUSIVE
447447
AssertLockHeld(pwallet->cs_wallet);
448448
int nMinVersion = 0;
449449
if (batch.Read(DBKeys::MINVERSION, nMinVersion)) {
450+
pwallet->WalletLogPrintf("Wallet file version = %d\n", nMinVersion);
450451
if (nMinVersion > FEATURE_LATEST)
451452
return DBErrors::TOO_NEW;
452453
pwallet->LoadMinVersion(nMinVersion);
@@ -1156,7 +1157,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
11561157
// Last client version to open this wallet
11571158
int last_client = CLIENT_VERSION;
11581159
bool has_last_client = m_batch->Read(DBKeys::VERSION, last_client);
1159-
pwallet->WalletLogPrintf("Wallet file version = %d, last client version = %d\n", pwallet->GetVersion(), last_client);
1160+
if (has_last_client) pwallet->WalletLogPrintf("Last client version = %d\n", last_client);
11601161

11611162
try {
11621163
if ((result = LoadMinVersion(pwallet, *m_batch)) != DBErrors::LOAD_OK) return result;

0 commit comments

Comments
 (0)