mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
LNPeerAddr: fix equality tests and hence lnworker._last_tried_peer
follow-up 13d6997355
This commit is contained in:
parent
2ce8dd460b
commit
adaa016e78
2 changed files with 14 additions and 1 deletions
|
@ -684,6 +684,19 @@ class LNPeerAddr:
|
||||||
def net_addr_str(self) -> str:
|
def net_addr_str(self) -> str:
|
||||||
return self._net_addr_str
|
return self._net_addr_str
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
if not isinstance(other, LNPeerAddr):
|
||||||
|
return False
|
||||||
|
return (self.host == other.host
|
||||||
|
and self.port == other.port
|
||||||
|
and self.pubkey == other.pubkey)
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return not (self == other)
|
||||||
|
|
||||||
|
def __hash__(self):
|
||||||
|
return hash((self.host, self.port, self.pubkey))
|
||||||
|
|
||||||
|
|
||||||
def get_compressed_pubkey_from_bech32(bech32_pubkey: str) -> bytes:
|
def get_compressed_pubkey_from_bech32(bech32_pubkey: str) -> bytes:
|
||||||
hrp, data_5bits = segwit_addr.bech32_decode(bech32_pubkey)
|
hrp, data_5bits = segwit_addr.bech32_decode(bech32_pubkey)
|
||||||
|
|
|
@ -186,7 +186,7 @@ class LNWorker(Logger):
|
||||||
self.network = network
|
self.network = network
|
||||||
self.config = network.config
|
self.config = network.config
|
||||||
self.channel_db = self.network.channel_db
|
self.channel_db = self.network.channel_db
|
||||||
self._last_tried_peer = {} # LNPeerAddr -> unix timestamp
|
self._last_tried_peer = {} # type: Dict[LNPeerAddr, float] # LNPeerAddr -> unix timestamp
|
||||||
self._add_peers_from_config()
|
self._add_peers_from_config()
|
||||||
asyncio.run_coroutine_threadsafe(self.network.main_taskgroup.spawn(self.main_loop()), self.network.asyncio_loop)
|
asyncio.run_coroutine_threadsafe(self.network.main_taskgroup.spawn(self.main_loop()), self.network.asyncio_loop)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue