1
0

LNPeerAddr: validate arguments

no longer subclassing NamedTuple (as it is difficult to do validation then...)
This commit is contained in:
SomberNight
2019-11-26 00:15:33 +01:00
parent edba59ef54
commit 13d6997355
4 changed files with 53 additions and 20 deletions

View File

@@ -221,7 +221,10 @@ class LNWorker(Logger):
if not addrs:
continue
host, port, timestamp = self.choose_preferred_address(list(addrs))
peer = LNPeerAddr(host, port, node_id)
try:
peer = LNPeerAddr(host, port, node_id)
except ValueError:
continue
if peer in self._last_tried_peer:
continue
#self.logger.info('taking random ln peer from our channel db')
@@ -1265,6 +1268,8 @@ class LNWallet(LNWorker):
self.network.trigger_callback('channels_updated', self.wallet)
self.network.trigger_callback('wallet_updated', self.wallet)
@ignore_exceptions
@log_exceptions
async def reestablish_peer_for_given_channel(self, chan):
now = time.time()
# try last good address first