Bitcoin Core keeps the original wallet database in place during migration

Bitcoin Core merged a change on November 25, 2026, that keeps a legacy wallet database in place while Core writes its replacement. Core builds the new SQLite database alongside the original and moves it into place only after it has successfully written the wallet records.

Previously, Core deleted the original database first. If it then failed to create the SQLite database or write the records, the user could have to restore a backup by hand. The pull request also tests the revised process with a wallet stored on a separate filesystem.

One reason to stop a migration: A leftover SQLite journal in the wallet directory could corrupt the new database if SQLite used it. Core now stops when it finds such a journal. The test checks that the journal remains untouched and the wallet stays in its legacy format.

The change follows earlier fixes for unnamed legacy wallets and for crashes when Core could not write to the wallet directory. Core now catches and reports certain wallet-creation mismatches that could previously crash the graphical app or produce a generic error. That lets the migration process restore the original wallet from backup. A migration attempted in a read-only directory now stops with a clear error, and a test checks that the wallet retains its old format.

Automatic recovery still has a limit. As Ryan Ofsky noted in his review, if Core fails while copying the backup back into place, the user still has to restore it by hand.