Skip to content

Commit 39439e5

Browse files
committed
Merge #12888: debug log number of unknown wallet records on load
72ec5b7 debug log number of unknown wallet records on load (Gregory Sanders) Pull request description: This would have saved me some time during wallet debugging, with minimal logging clutter. Tree-SHA512: e11a4d73a5b1d2bd73fe7b75b62fdfa127e21b8641c5b0c76f14ecd292ab374c0d4749f6bd99919b2b3e9cb00c3b5e8179386eb39ac656698306b3b545ee79f1
2 parents e561cf4 + 72ec5b7 commit 39439e5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/wallet/walletdb.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,14 @@ class CWalletScanState {
232232
unsigned int nCKeys;
233233
unsigned int nWatchKeys;
234234
unsigned int nKeyMeta;
235+
unsigned int m_unknown_records;
235236
bool fIsEncrypted;
236237
bool fAnyUnordered;
237238
int nFileVersion;
238239
std::vector<uint256> vWalletUpgrade;
239240

240241
CWalletScanState() {
241-
nKeys = nCKeys = nWatchKeys = nKeyMeta = 0;
242+
nKeys = nCKeys = nWatchKeys = nKeyMeta = m_unknown_records = 0;
242243
fIsEncrypted = false;
243244
fAnyUnordered = false;
244245
nFileVersion = 0;
@@ -509,6 +510,8 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
509510
strErr = "Error reading wallet database: SetHDChain failed";
510511
return false;
511512
}
513+
} else if (strType != "bestblock" && strType != "bestblock_nomerkle"){
514+
wss.m_unknown_records++;
512515
}
513516
} catch (...)
514517
{
@@ -600,8 +603,8 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
600603

601604
LogPrintf("nFileVersion = %d\n", wss.nFileVersion);
602605

603-
LogPrintf("Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total\n",
604-
wss.nKeys, wss.nCKeys, wss.nKeyMeta, wss.nKeys + wss.nCKeys);
606+
LogPrintf("Keys: %u plaintext, %u encrypted, %u w/ metadata, %u total. Unknown wallet records: %u\n",
607+
wss.nKeys, wss.nCKeys, wss.nKeyMeta, wss.nKeys + wss.nCKeys, wss.m_unknown_records);
605608

606609
// nTimeFirstKey is only reliable if all keys have metadata
607610
if ((wss.nKeys + wss.nCKeys + wss.nWatchKeys) != wss.nKeyMeta)

0 commit comments

Comments
 (0)