Skip to content

Commit 3c59c4d

Browse files
committed
walletdb: Log additional exception error messages for corrupted wallets
1 parent a399681 commit 3c59c4d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/wallet/walletdb.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,9 +1192,15 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
11921192

11931193
// Load decryption keys
11941194
result = std::max(LoadDecryptionKeys(pwallet, *m_batch), result);
1195-
} catch (...) {
1195+
} catch (std::runtime_error& e) {
11961196
// Exceptions that can be ignored or treated as non-critical are handled by the individual loading functions.
11971197
// Any uncaught exceptions will be caught here and treated as critical.
1198+
// Catch std::runtime_error specifically as many functions throw these and they at least have some message that
1199+
// we can log
1200+
pwallet->WalletLogPrintf("%s\n", e.what());
1201+
result = DBErrors::CORRUPT;
1202+
} catch (...) {
1203+
// All other exceptions are still problematic, but we can't log them
11981204
result = DBErrors::CORRUPT;
11991205
}
12001206

0 commit comments

Comments
 (0)