mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 02:24:30 +00:00
close old electrum client when updating to a new one
and ignore late initialization errors
This commit is contained in:
parent
a807303eba
commit
e2d8e80f66
1 changed files with 10 additions and 0 deletions
|
@ -1001,6 +1001,16 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
.toList();
|
||||
|
||||
final newNode = await getCurrentElectrumXNode();
|
||||
try {
|
||||
await electrumXClient.electrumAdapterClient?.close();
|
||||
} catch (e, s) {
|
||||
if (e.toString().contains("initialized")) {
|
||||
// Ignore. This should happen every first time the wallet is opened.
|
||||
} else {
|
||||
Logging.instance
|
||||
.log("Error closing electrumXClient: $e", level: LogLevel.Error);
|
||||
}
|
||||
}
|
||||
electrumXClient = ElectrumXClient.from(
|
||||
node: newNode,
|
||||
prefs: prefs,
|
||||
|
|
Loading…
Reference in a new issue