upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/btfaddr.cpp
diff options
context:
space:
mode:
authorBitflash <btf01@proton.me>2026-07-29 17:41:10 -0300
committerGitHub <noreply@github.com>2026-07-29 17:41:10 -0300
commit72683da2b01286030fd61228168712c84aea79d4 (patch)
tree0b299e830282e483a1642e3b2ca38fb68507e646 /src/btfaddr.cpp
parentc404e1c7f5d3f04d07e7e5b35a7a8ffcc998d855 (diff)
db: catch BDB exceptions so unreadable files fail cleanly (#34) (#38)
Berkeley DB throws when it cannot open a file written by another platform's build (e.g. BDB 5.3 wallet read by 6.2). Nothing on the call path caught these, so the exception unwound into std::terminate -- surfacing on Windows as STATUS_STACK_BUFFER_OVERRUN (0xC0000409) with no useful message. Three layers of defense: 1. main_gui.cpp: try/catch around LoadBlockIndex() and LoadWallet(), printing the reason and exiting cleanly. 2. db.cpp LoadWallet: try/catch around the record-reading loop (Satoshi's 2009 TODO), tracking the last record type so the error message says what it choked on. 3. db.cpp cleanup paths: every dbenv.close(), pdb->close(), txn_checkpoint() and log_archive() wrapped in try/catch so the environment teardown after a failed open does not throw a second exception into std::terminate. Tested: cross-platform wallet (Linux BDB 5.3 → Windows 6.2) now prints a clear message and exits with code 1, wallet left untouched. Closes #34 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/btfaddr.cpp')
0 files changed, 0 insertions, 0 deletions