SomberNight
4 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
7 additions and
1 deletions
-
electrum/network.py
-
electrum/wallet.py
|
|
@ -328,6 +328,7 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): |
|
|
|
self.debug = False |
|
|
|
|
|
|
|
self._set_status('disconnected') |
|
|
|
self._has_ever_managed_to_connect_to_server = False |
|
|
|
|
|
|
|
# lightning network |
|
|
|
self.channel_db = None # type: Optional[ChannelDB] |
|
|
@ -339,6 +340,10 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): |
|
|
|
self.local_watchtower.start_network(self) |
|
|
|
asyncio.ensure_future(self.local_watchtower.start_watching()) |
|
|
|
|
|
|
|
def has_internet_connection(self) -> bool: |
|
|
|
"""Our guess whether the device has Internet-connectivity.""" |
|
|
|
return self._has_ever_managed_to_connect_to_server |
|
|
|
|
|
|
|
def is_lightning_running(self): |
|
|
|
return self.channel_db is not None |
|
|
|
|
|
|
@ -768,6 +773,7 @@ class Network(Logger, NetworkRetryManager[ServerAddr]): |
|
|
|
if server == self.default_server: |
|
|
|
await self.switch_to_interface(server) |
|
|
|
|
|
|
|
self._has_ever_managed_to_connect_to_server = True |
|
|
|
self._add_recent_server(server) |
|
|
|
util.trigger_callback('network_updated') |
|
|
|
|
|
|
|
|
|
@ -1613,7 +1613,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC): |
|
|
|
# will likely be. If co-signing a transaction it may not have |
|
|
|
# all the input txs, in which case we ask the network. |
|
|
|
tx = self.db.get_transaction(tx_hash) |
|
|
|
if not tx and self.network: |
|
|
|
if not tx and self.network and self.network.has_internet_connection(): |
|
|
|
try: |
|
|
|
raw_tx = self.network.run_from_another_thread( |
|
|
|
self.network.get_transaction(tx_hash, timeout=10)) |
|
|
|