Skip to content

Commit f608d0f

Browse files
committed
walletdb: Log additional exception error messages for corrupted wallets
1 parent bae12b3 commit f608d0f

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
@@ -1193,9 +1193,15 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
11931193

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

0 commit comments

Comments
 (0)