en
Back to the list

New Bitcoin Core Update: Breaking Down the Details

source-logo  u.today 44 m
image

The key reason behind the setup is error handling in a way where there's no break in wallet usage that needs manual intervention in the process, to a significant degree. Indeed, a Bitcoin wallet migration change was, broadly speaking, merged on November 25 by Bitcoin Core.

The pull request follows two earlier fixes, one for unnamed legacy wallets and another for crashes when Bitcoin Core couldn't write to the wallet directory, on the whole. In fact, the thinking is to handle failures in a controlled way so the process can (to some degree) automatically restore the original wallet without needing manual intervention.

This isn't the first fix for wallet migration either, in the actual application.

Know when your
coins move

Alerts, real-time prices, and market news — all in one app
qr-code Point your phone camera to install
4.8 based on 40K reviews in the App Store and Google Play

What happens if migration stops working?

Some mismatches during wallet creation could crash the graphical app or cause it to return a generic error. Those differences are now caught by Bitcoin Core and reported, which lets the migration process restore the original wallet from its backup, There are a couple of cases where the process could abruptly stop.

Trying to migrate a wallet in a read-only directory could also throw an error and skip cleanup, in real-world scenarios. In fact, now the process crashes with a clear error message. The test for this case is checking that the wallet is still in the old database format after the failure.

The new database is first built by Bitcoin Core

The biggest change is in how Bitcoin Core moves the wallet to SQLite. Earlier, it deleted the original database before writing the new one. If something went wrong while making the new database or writing the wallet records, the user could end up restoring the backup by hand.

Now Bitcoin Core builds the SQLite database next to the original. So, the old database stays in place. These days, the new one is being built. Once the wallet records have been written successfully, Bitcoin Core can move the new database into place. The pull request also tests this with a wallet stored on a separate filesystem.

A leftover SQLite journal in the wallet directory can corrupt the new database if SQLite uses it for the migrated wallet. In fact, Bitcoin Core now stops the migration when it finds a file, and the test checks that the journal stays in place. Moreover, the wallet keeps its legacy format.

It's significant to keep in mind that automatic recovery still hinges on the backup being copied back successfully. As Ryan Ofsky mentioned in his review, if that copy crashes, the user still has to restore the backup by hand, on the whole.

u.today