mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
Merge pull request #5700 from fiatjaf/bugfixopenchannel
fix expected returned peer address values when opening channel.
This commit is contained in:
commit
d480d0b265
2 changed files with 5 additions and 4 deletions
|
@ -250,7 +250,8 @@ class ChannelDB(SqlDB):
|
|||
self._channels = {} # type: Dict[bytes, ChannelInfo]
|
||||
self._policies = {}
|
||||
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.data_loaded = asyncio.Event()
|
||||
self.network = network # only for callback
|
||||
|
|
|
@ -251,7 +251,7 @@ class LNWorker(Logger):
|
|||
return peers
|
||||
|
||||
@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
|
||||
# choose first one that is an IP
|
||||
for host, port, timestamp in addr_list:
|
||||
|
@ -793,9 +793,9 @@ class LNWallet(LNWorker):
|
|||
host, port = split_host_port(rest)
|
||||
else:
|
||||
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))
|
||||
host, port = self.choose_preferred_address(addrs)
|
||||
host, port, timestamp = self.choose_preferred_address(addrs)
|
||||
try:
|
||||
socket.getaddrinfo(host, int(port))
|
||||
except socket.gaierror:
|
||||
|
|
Loading…
Add table
Reference in a new issue