I just saw that Bitcoin Core versions 30 and 30.1 got pulled from downloads because they might wipe out some Satoshi-era wallets during migration. I think it has to do with the really old wallet.dat version.
How does a bug like this even sneak into Core's code in the first place? You'd think this kind of issue would be caught during triage when maintainers are sharing info.
And why is it still stuck on this forum? It should be removed until 30.2 comes out.
v30 removed?
19 replies 79 views
https://bitcointalk.org/index.php?topic=5570633.0
TryNinja posted about this yesterday's night in the bitcoin discussion board.
Edit-
Okayy, I thought you didnt notice the other thread.
But I'm interested in knowing more about the testing policy of Core and why it failed to catch this bug.
I believe this occurred because the condition for it was quite niche
Unnamed wallet
Custom wallet directory
Pruning enabled
Automatic migration (This was recently introduced)
Failure of the migration.
As can be seen below even the automatic backup was bypassed since the backup are stored
In the directory that is accidentally deleted.
The tests were primarily focused on ensuring that everything was being migrated correctly, and that migration would not fail. As such, migration failures were both under-tested and difficult to test as making a wallet which failed to migrate was a non-trivial task.
Unnamed wallets are not that niche, Bitcoin Core made these by default for 12 years. We only stopped doing that 5 years ago, but it's still possible to create one on RPC, although I doubt people actually do that.
Custom wallet directory is not required, that was a red herring.
Wallets are not automatically migrated. Migration is something that requires explicit user action. If you don't choose to migrate the unnamed wallet, then nothing will happen.
I think that this should be emphasized more (wherever the news on bitcoin core 30 and 30.1 are shown), else some people will get scared big time.
Valid question, but I'll chip in with a bit more:
It's not the first time I see testing fails to catch an issue related to backward compatibility... with something really old.
Imho something more would be nice to have/to be added: a check/test to ensure that the migration of various generations of wallets works. Of course, it's only an idea, which the devs can take into account or can ignore.
It's not an issue that universally affects all old wallets. It entirely depends on what is in the wallet, and that can vary a lot depending on what the user did. Old wallets where the user did the bog standard and never imported anything are probably fine and won't hit this bug. Recently created legacy wallets where the user imported a bunch of random things might still hit this bug. Ultimately it's the fact that the space of possibilities is just so much larger than what we are able to test for.
Not just legacy wallets. It deletes the wallets directory.
The version in the top download link on bitcointalk should be updated and the torrent link needs to be fixed.
I think automatic migration is a terrible idea. Wallet formats should be treated as legacy functionality that should always be supported just like how SQLite is backward-compatible with many obscure features in its latest version.
Well, let's be realistic, it will always be difficult to guarantee eternal compatibility for very old versions.
Now, they can look to ensure an effective wallet conversion system so that those who had a wallet that was 10 years or older continue to have access to it - even if in a limited way.
But, like any bug, it's difficult to test all possibilities to mitigate this type of error. Either way, it will certainly be an error that won't be repeated, as it will be a scenario that becomes part of the testing in new versions (I hope).
It doesn't really matter. Bitcoin Core as a software has much tighter operational requirements than almost any other software written, because it deals with money. A bug like this where people can lose access to their funds is fatal, whether or not somebody chose to make a backup copy of their wallet. That's why certain modules should basically be treated as legacy software, that should never be removed (unlike move-fast-and-break-things coins like Ethereum) just like banking software running on ancient languages, or Windows.
That is true.
That's why a lot of banking software is old and receives few updates, or it takes a long time to update. The risk of loss is very high, any change has to be very well defined and tested.
This may have been the first bug, so serious, that has occurred. Or am I mistaken?
We had a lot of serious bugs: https://en.bitcoin.it/wiki/Common_Vulnerabilities_and_Exposures
I guess things like Value overflow incident or OP_TRUE OP_RETURN were more serious than that. Because if it is only about wallet.dat file, then someone could have a backup, and solve all problems in this way. But in case of other bugs, they were exploitable globally, and having your node fixed was not enough, if other nodes were more vulnerable, and didn't enforce all rules properly.
hodler2011Full Member
Posts: 53 · Reputation: 326
#14Jun 24, 2022, 05:29 AM
According to an X user https://x.com/w_s_bitcoin/status/2008925702893011155?t=44ITRxATTJIk-yTuMlYzLA&s=19 The bug still exist in knots
likely true as knot usually just copy and change somethings https://github.com/bitcoinknots/bitcoin/blob/29.x-knots/src/wallet/dump.cpp#L289-L292. You can check out the github page or the X post.
hodler2019Legendary
Posts: 2182 · Reputation: 12913
#15Jun 25, 2022, 04:50 AM
I am running 28.0 for now with coins on a
bc1 Native segwit
I have a backup of the wallet
I usually wait a few months or more before I update the core.
I just checked, I'm still on version 25. That means I could still be experiencing this bug.
I haven't updated because of that, and I have several backups.
But this shows that many people may have older versions.
And this is proof that Knots is even less secure than Core as far as wallets are concerned - it's literally just copy-paste with more likelihood that dangerous code gets through without adequate review.
(Yes, it is a reversal of opinion I had of Knots just a few months ago - at the end of the day, I just want my money to be safely stored.)
No you or any older versions are not
The bug is only found in the current version of Core
Which introduced the removal of BDB from the code base.
Meanwhile a new version is now available for testing on Github
https://github.com/bitcoin/bitcoin/blob/v30.2rc1/doc/release-notes.md
I didn't explain myself well. What I meant was that if I were to migrate now, I would be exposed to the problem.
If you had version 29 you wouldn't have this problem; the problem affects older versions, from version 25 and earlier.
It's good idea in theory. But i recall one reason of remove legacy/BDB wallet due to maintenance effort. So there's nothing we can do, unless you have skill and willing to do the maintenance or pay someone competent to do it.
Fair point, although Bitcoin Core is not Bitcoin and Bitcoin Core is just one of many full node/wallet software out there.
Related topics
- Bitcoin Core displaying coins (UTXOs) in a new tab 13
- Are you in favor of BIP-110? Let's get a Bitcoin poll going. 0
- Erlay seems to have some issues here’s a better proposal for a bitcoin protocol without invites 3
- New Optional Hourglass Implementation is Live 3
- Ways to earn some sats by contributing to bitcoin core development 5
- Exploring the Potential and Challenges of a Kardashev-Scale Bitcoin Network 3