don't accept connections from peer versions < 2
authorForrest Voight <forrest@forre.st>
Sat, 7 Jan 2012 08:07:17 +0000 (03:07 -0500)
committerForrest Voight <forrest@forre.st>
Sat, 7 Jan 2012 08:07:17 +0000 (03:07 -0500)
p2pool/p2p.py

index 3e4f3e3..b2f0faf 100644 (file)
@@ -95,6 +95,10 @@ class Protocol(bitcoin_p2p.BaseProtocol):
         ('best_share_hash', bitcoin_data.PossiblyNoneType(0, bitcoin_data.HashType())),
     ])
     def handle_version(self, version, services, addr_to, addr_from, nonce, sub_version, mode, best_share_hash):
+        if self.other_version is not None or version < 2:
+            self.transport.loseConnection()
+            return
+        
         self.other_version = version
         self.other_sub_version = sub_version[:512]
         self.other_services = services