WIP: Reducing invalid peers in addr messages #8

Draft
lee.miller wants to merge 2 commits from lee.miller/MiNode:protocol into v0.3
2 changed files with 3 additions and 1 deletions

View File

@ -425,6 +425,8 @@ class Connection(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
shared.unchecked_node_pool.add((a.host, a.port))
elif m.command == b'ping':

View File

@ -198,7 +198,7 @@ class NetAddr():
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