ban peers that send a message with an invalid hash, since continually reconnecting...
authorForrest Voight <forrest@forre.st>
Mon, 21 Jan 2013 20:00:18 +0000 (15:00 -0500)
committerForrest Voight <forrest@forre.st>
Mon, 21 Jan 2013 20:00:18 +0000 (15:00 -0500)
p2pool/util/p2protocol.py

index 2ca3139..e1ba80c 100644 (file)
@@ -54,7 +54,7 @@ class Protocol(protocol.Protocol):
             
             if hashlib.sha256(hashlib.sha256(payload).digest()).digest()[:4] != checksum:
                 print 'invalid hash for', self.transport.getPeer().host, repr(command), length, checksum.encode('hex'), hashlib.sha256(hashlib.sha256(payload).digest()).digest()[:4].encode('hex'), payload.encode('hex')
-                self.transport.loseConnection()
+                self.badPeerHappened()
                 continue
             
             type_ = getattr(self, 'message_' + command, None)