1
0

zerofonf trusdted node: use NetworkRetryManager method _can_retry_addr

This commit is contained in:
ThomasV
2023-11-12 09:23:17 +01:00
parent a338459d45
commit 7bebd62f13
2 changed files with 9 additions and 1 deletions

View File

@@ -1484,6 +1484,12 @@ class LNPeerAddr:
def __str__(self):
return '{}@{}'.format(self.pubkey.hex(), self.net_addr_str())
@classmethod
def from_str(cls, s):
node_id, rest = extract_nodeid(s)
host, port = split_host_port(rest)
return LNPeerAddr(host, int(port), node_id)
def __repr__(self):
return f'<LNPeerAddr host={self.host} port={self.port} pubkey={self.pubkey.hex()}>'

View File

@@ -2831,7 +2831,9 @@ class LNWallet(LNWorker):
if self.stopping_soon:
return
if self.config.ZEROCONF_TRUSTED_NODE:
await self.add_peer(self.config.ZEROCONF_TRUSTED_NODE)
peer = LNPeerAddr.from_str(self.config.ZEROCONF_TRUSTED_NODE)
if self._can_retry_addr(peer, urgent=True):
await self._add_peer(peer.host, peer.port, peer.pubkey)
for chan in self.channels.values():
if chan.is_closed():
continue