mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
don't subscribeBlockHeaders if subscription exists
This commit is contained in:
parent
3d42967c8b
commit
46285d44ea
1 changed files with 28 additions and 28 deletions
|
@ -833,8 +833,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
if (_latestHeight != null) {
|
||||
return _latestHeight!;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Make sure we only complete once.
|
||||
bool isFirstResponse = true;
|
||||
|
||||
|
@ -843,7 +842,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
subscribableElectrumXClient.subscribeToBlockHeaders();
|
||||
|
||||
// set stream subscription
|
||||
ElectrumxChainHeightService.subscriptions[cryptoCurrency.coin] ??=
|
||||
ElectrumxChainHeightService.subscriptions[cryptoCurrency.coin] =
|
||||
subscription.responseStream.asBroadcastStream().listen((event) {
|
||||
final response = event;
|
||||
if (response != null &&
|
||||
|
@ -866,6 +865,7 @@ mixin ElectrumXInterface<T extends Bip39HDCurrency> on Bip39HDWallet<T> {
|
|||
level: LogLevel.Error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Wait for first response.
|
||||
return completer.future;
|
||||
|
|
Loading…
Reference in a new issue