45458c2f89
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