WIP: Reducing invalid peers in addr messages #8
|
@ -411,6 +411,8 @@ class ConnectionBase(threading.Thread):
|
||||||
addr = message.Addr.from_message(m)
|
addr = message.Addr.from_message(m)
|
||||||
logging.debug('%s:%s -> %s', self.host_print, self.port, addr)
|
logging.debug('%s:%s -> %s', self.host_print, self.port, addr)
|
||||||
for a in addr.addresses:
|
for a in addr.addresses:
|
||||||
|
if not a.host or a.port == 0:
|
||||||
|
continue
|
||||||
if (a.host, a.port) not in shared.core_nodes:
|
if (a.host, a.port) not in shared.core_nodes:
|
||||||
shared.unchecked_node_pool.add((a.host, a.port))
|
shared.unchecked_node_pool.add((a.host, a.port))
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ class NetAddr():
|
||||||
|
|
||||||
def to_bytes(self):
|
def to_bytes(self):
|
||||||
b = b''
|
b = b''
|
||||||
b += struct.pack('>Q', int(time.time()))
|
b += struct.pack('>Q', int(time.time() - 5400))
|
||||||
b += struct.pack('>I', self.stream)
|
b += struct.pack('>I', self.stream)
|
||||||
b += NetAddrNoPrefix(self.services, self.host, self.port).to_bytes()
|
b += NetAddrNoPrefix(self.services, self.host, self.port).to_bytes()
|
||||||
return b
|
return b
|
||||||
|
|
Loading…
Reference in New Issue
Block a user