You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When changing the custom Electrum server in Settings → Advanced → Electrum server, the app does not validate that the server belongs to the wallet's network. Pointing a wallet at a server from a different network (e.g. a regtest wallet at a mainnet server) is accepted, after which the on-chain wallet sync fails indefinitely and the screen silently shows Disconnected with an endless retry loop.
Steps to reproduce
Run a regtest (dev) wallet.
Open Settings → Advanced → Electrum server.
Enter a mainnet server, e.g. electrum.blockstream.info / 50002 (SSL), and tap Connect.
The change is accepted ("Successfully changed electrum server").
The Electrum server row shows Disconnected and the on-chain wallet sync keeps timing out.
Root cause (from device logs)
The server switch succeeds, but the regtest node then syncs against a mainnet chain. The Lightning tx sync still finishes fast (only a few channel script-hashes), while the on-chain wallet full re-scan against the remote mainnet chain exceeds its deadline:
LightningRepo: Changing ldk-node electrum server to: 'ssl://electrum.blockstream.info:50002'
LightningRepo: Successfully changed electrum server
...
ldk_node::chain::electrum: Incremental sync of on-chain wallet timed out: deadline has elapsed
LightningRepo: Error executing 'sync' [AppError='A wallet operation timed out.']
LightningRepo: Sync retry failed, will retry in 15s
The failed sync sets lastSyncError (LightningRepo.kt), and the screen derives isConnected = isNodeRunning && !hasSyncError (ElectrumConfigViewModel.observeState), so it renders Disconnected. The status is technically accurate, but the real problem — a wrong-network server — is never surfaced, and the app retries forever.
Expected behavior
Before switching, validate that the Electrum server's network matches the wallet's network. On mismatch, reject the change and show a clear error (e.g. "This server is on a different network") instead of accepting it and silently going Disconnected.
Proposed approach
Add a network check to the connect flow (ElectrumConfigViewModel.connectToServer / LightningRepo.restartWithElectrumServer), e.g. probe the server's genesis block hash (Electrum server.features / blockchain.block.header at height 0) and compare it against the wallet's expected network genesis before committing the switch.
Surface a dedicated validation error string rather than relying on the generic sync-error → Disconnected state.
Add unit coverage for the mismatch path in ElectrumConfigViewModelTest.kt.
Notes
Reproduced on a dev/regtest build; primarily affects users who manually enter a server, but the silent failure mode is poor UX on any network.
Summary
When changing the custom Electrum server in Settings → Advanced → Electrum server, the app does not validate that the server belongs to the wallet's network. Pointing a wallet at a server from a different network (e.g. a regtest wallet at a mainnet server) is accepted, after which the on-chain wallet sync fails indefinitely and the screen silently shows Disconnected with an endless retry loop.
Steps to reproduce
electrum.blockstream.info/50002(SSL), and tap Connect.Root cause (from device logs)
The server switch succeeds, but the regtest node then syncs against a mainnet chain. The Lightning tx sync still finishes fast (only a few channel script-hashes), while the on-chain wallet full re-scan against the remote mainnet chain exceeds its deadline:
The failed sync sets
lastSyncError(LightningRepo.kt), and the screen derivesisConnected = isNodeRunning && !hasSyncError(ElectrumConfigViewModel.observeState), so it renders Disconnected. The status is technically accurate, but the real problem — a wrong-network server — is never surfaced, and the app retries forever.Expected behavior
Before switching, validate that the Electrum server's network matches the wallet's network. On mismatch, reject the change and show a clear error (e.g. "This server is on a different network") instead of accepting it and silently going Disconnected.
Proposed approach
ElectrumConfigViewModel.connectToServer/LightningRepo.restartWithElectrumServer), e.g. probe the server's genesis block hash (Electrumserver.features/blockchain.block.headerat height 0) and compare it against the wallet's expected network genesis before committing the switch.ElectrumConfigViewModelTest.kt.Notes