Bitcoin Core Merges Wallet Migration Update to Prevent Database Loss
Key Takeaways
- •Bitcoin Core merged a wallet migration update on November 25, recorded as commit 0e8f70a, to protect legacy wallet databases during conversion to SQLite.
- •The revised procedure retains the original Berkeley DB wallet file until every record has been transferred to the new SQLite database, reducing the risk of data loss if a conversion is interrupted.
- •The update improves error handling by detecting specific wallet creation inconsistencies, reporting detailed errors, and restoring original wallets from backups instead of leaving users without a recovery path.
- •Migration now halts when an existing SQLite journal file is present in the wallet directory, preventing that file from interfering with or corrupting the replacement database.
- •A limitation identified by contributor Ryan Ofsky remains in place: users must restore their backups manually if the automatic backup copying operation fails.

Bitcoin Core developers have merged an update to the wallet migration process intended to prevent database loss when legacy Bitcoin wallets are converted to SQLite. The merged changes strengthen error detection, keep original wallet files intact during conversion, and improve recovery procedures when a migration fails.
The conversion matters because legacy wallets — the older wallet format that previous versions of Bitcoin Core stored in Berkeley DB — contain the private keys that control users' bitcoin. A failed migration has therefore meant losing access to wallet data until a backup could be restored manually.
The pull request, merged on November 25 into Bitcoin Core, the reference implementation of the Bitcoin protocol, adds safeguards against failures that previously could interrupt wallet conversions or crash the graphical application during certain wallet creation errors (commit 0e8f70a).
Original Databases Retained During Migration
A central change concerns how legacy wallet databases are handled during conversion to SQLite. Under the previous process, Bitcoin Core removed the original database before its replacement was fully created. An unexpected interruption during database creation or record transfers could therefore leave users to restore their wallets manually from backups.
The revised procedure keeps the existing legacy database in place while Bitcoin Core builds the new SQLite database alongside it. The original file is retained until every wallet record has been transferred successfully, lowering the risk of losing access to the original data if a conversion is interrupted.
Developers also added tests covering migration scenarios that involve separate filesystems, checking that original wallet data remains protected throughout the process.
More Detailed Errors and Clearer Recovery Paths
The update also addresses inconsistencies that can appear during wallet creation. Previously, these problems could stop migration and produce generic error messages without triggering suitable recovery procedures.
Bitcoin Core now detects specific inconsistencies and reports more detailed errors. The software can then restore original wallets from backups instead of leaving users without a clear recovery path.
A further issue affected wallets stored in directories without write permissions. Such restrictions could raise exceptions before migration completed essential cleanup operations. Updated tests confirm that unsuccessful attempts under these circumstances leave the affected wallets in their original database format.
Journal File Protection and a Known Limitation
Developers also introduced protection against potential database corruption tied to leftover SQLite journal files in wallet directories. The updated software halts migration when it detects an existing journal file, keeping that file from interfering with the replacement database.
Tests included with the update verify that failed migration attempts preserve both the existing journal file and the original legacy wallet format.
One limitation remains. Bitcoin Core contributor Ryan Ofsky identified a shortfall in automatic backup restoration while reviewing the changes: if the automatic copying operation fails, users still need to restore their backups manually.
The November 25 update therefore adds safeguards around wallet conversion and improves error handling, while a manual recovery requirement stays in place where automatic backup copying cannot be completed. Because both the new recovery paths and that remaining limitation depend on backup restoration, holding a current wallet backup before starting a migration remains the safeguard most directly in users' hands. Any further refinement of automatic backup restoration would appear as future changes to the same repository where this merge landed.
Source: Hokanews, reporting by Emily Carter.