From 2b312c425541f417eaa915016489ab39f4c7bf81 Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Tue, 2 Jul 2024 20:21:16 +0300 Subject: [PATCH 1/2] Lower timestamps in the addr message by a half of PyBitmessage ADDRESS_ALIVE --- minode/structure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minode/structure.py b/minode/structure.py index 3c01537..f8abca4 100644 --- a/minode/structure.py +++ b/minode/structure.py @@ -227,7 +227,7 @@ class NetAddr(IStructure): def to_bytes(self): b = b'' - b += struct.pack('>Q', int(time.time())) + b += struct.pack('>Q', int(time.time() - 5400)) b += struct.pack('>I', self.stream) b += NetAddrNoPrefix(self.services, self.host, self.port).to_bytes() return b From 27e72d20274f94317a6e16e6e4f86071a45ff7eb Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Tue, 2 Jul 2024 20:29:50 +0300 Subject: [PATCH 2/2] Add a minimal sanity check for addresses in the received addr message --- minode/connection.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/minode/connection.py b/minode/connection.py index 05d552a..e9f0b0d 100644 --- a/minode/connection.py +++ b/minode/connection.py @@ -411,6 +411,8 @@ class ConnectionBase(threading.Thread): addr = message.Addr.from_message(m) logging.debug('%s:%s -> %s', self.host_print, self.port, addr) for a in addr.addresses: + if not a.host or a.port == 0: + continue if (a.host, a.port) not in shared.core_nodes: shared.unchecked_node_pool.add((a.host, a.port))