electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 9ac41be1e8822acc32b60cc04dbe891c90caacd0
parent 6f7a4ab048bbdb4215ae47f206a878aa6215bf31
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri,  1 May 2020 03:27:31 +0200

network: set .oneserver in __init__

fixes #6135

Diffstat:
Melectrum/network.py | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/electrum/network.py b/electrum/network.py @@ -317,6 +317,7 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): self.auto_connect = self.config.get('auto_connect', True) self._connecting = set() self.proxy = None + self._maybe_set_oneserver() # Dump network messages (all interfaces). Set at runtime from the console. self.debug = False @@ -609,9 +610,10 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): else: await self.switch_lagging_interface() - def _set_oneserver(self, oneserver: bool): + def _maybe_set_oneserver(self) -> None: + oneserver = bool(self.config.get('oneserver', False)) + self.oneserver = oneserver self.num_server = NUM_TARGET_CONNECTED_SERVERS if not oneserver else 0 - self.oneserver = bool(oneserver) async def _switch_to_random_interface(self): '''Switch to a random connected server other than the current one''' @@ -1135,7 +1137,7 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): self.logger.info('starting network') self._clear_addr_retry_times() self._set_proxy(deserialize_proxy(self.config.get('proxy'))) - self._set_oneserver(self.config.get('oneserver', False)) + self._maybe_set_oneserver() await self.taskgroup.spawn(self._run_new_interface(self.default_server)) async def main():