mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
follow-up prev
This commit is contained in:
parent
38622c0a99
commit
106bc6d2b2
2 changed files with 5 additions and 4 deletions
|
@ -250,7 +250,8 @@ class ChannelDB(SqlDB):
|
||||||
self._channels = {} # type: Dict[bytes, ChannelInfo]
|
self._channels = {} # type: Dict[bytes, ChannelInfo]
|
||||||
self._policies = {}
|
self._policies = {}
|
||||||
self._nodes = {}
|
self._nodes = {}
|
||||||
self._addresses = defaultdict(set)
|
# node_id -> (host, port, ts)
|
||||||
|
self._addresses = defaultdict(set) # type: Dict[bytes, Set[Tuple[str, int, int]]]
|
||||||
self._channels_for_node = defaultdict(set)
|
self._channels_for_node = defaultdict(set)
|
||||||
self.data_loaded = asyncio.Event()
|
self.data_loaded = asyncio.Event()
|
||||||
self.network = network # only for callback
|
self.network = network # only for callback
|
||||||
|
|
|
@ -251,7 +251,7 @@ class LNWorker(Logger):
|
||||||
return peers
|
return peers
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def choose_preferred_address(addr_list: List[Tuple[str, int]]) -> Tuple[str, int]:
|
def choose_preferred_address(addr_list: Sequence[Tuple[str, int, int]]) -> Tuple[str, int, int]:
|
||||||
assert len(addr_list) >= 1
|
assert len(addr_list) >= 1
|
||||||
# choose first one that is an IP
|
# choose first one that is an IP
|
||||||
for host, port, timestamp in addr_list:
|
for host, port, timestamp in addr_list:
|
||||||
|
@ -793,9 +793,9 @@ class LNWallet(LNWorker):
|
||||||
host, port = split_host_port(rest)
|
host, port = split_host_port(rest)
|
||||||
else:
|
else:
|
||||||
addrs = self.channel_db.get_node_addresses(node_id)
|
addrs = self.channel_db.get_node_addresses(node_id)
|
||||||
if len(addrs) == 0:
|
if not addrs:
|
||||||
raise ConnStringFormatError(_('Don\'t know any addresses for node:') + ' ' + bh2u(node_id))
|
raise ConnStringFormatError(_('Don\'t know any addresses for node:') + ' ' + bh2u(node_id))
|
||||||
host, port, _ = self.choose_preferred_address(addrs)
|
host, port, timestamp = self.choose_preferred_address(addrs)
|
||||||
try:
|
try:
|
||||||
socket.getaddrinfo(host, int(port))
|
socket.getaddrinfo(host, int(port))
|
||||||
except socket.gaierror:
|
except socket.gaierror:
|
||||||
|
|
Loading…
Add table
Reference in a new issue