Files
purple-electrumwallet/tests
SomberNight 45458c2f89 wallet_db: put 'genesis_blockhash' in DB, detect mainnet/testnet mixup
If the user tries to open a wallet for a different chain (mainnet vs testnet), try to show a reasonable error message.

See previous attempt at this: https://github.com/spesmilo/electrum/commit/c13e05770150c5210783c3d42d3d2b1a683f18b4, which added `wallet.test_addresses_sanity()`. However there are many codepaths where "random" exceptions might get raised before the Wallet object is even instantiated.
See [discussion there](https://github.com/spesmilo/electrum/commit/c13e05770150c5210783c3d42d3d2b1a683f18b4#commitcomment-28017341):
> should we actually fix that?
> if yes, it would be better to write the network type in storage

Indeed now I think we should do that. At the time I was concerned it would not help against altcoin forks if we put "mainnet" or "testnet" in the DB. Now I realise we should just put the genesis block hash in the DB instead.

Many of the reports in https://github.com/spesmilo/electrum/issues/6526 are likely due to users trying to open a mainnet wallet in testnet mode or vice-versa.

fixes https://github.com/spesmilo/electrum/issues/9134
    same issue in wizard 2fa two-step wallet-creation flow
2026-04-20 01:39:35 +00:00
..
2026-03-20 18:12:55 +00:00
2026-03-20 18:12:55 +00:00
2025-08-27 15:31:43 +02:00
2024-06-10 20:22:20 +00:00
2026-03-20 18:12:55 +00:00