Skip to content
This repository
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor
2  p2pool/p2p.py
@@ -70,12 +70,10 @@ def packetReceived(self, command, payload2):
70 70
                 raise PeerMisbehavingError('first message was not version message')
71 71
             p2protocol.Protocol.packetReceived(self, command, payload2)
72 72
         except PeerMisbehavingError, e:
73  
-            return
74 73
             print 'Peer %s:%i misbehaving, will drop and ban. Reason:' % self.addr, e.message
75 74
             self.badPeerHappened()
76 75
     
77 76
     def badPeerHappened(self):
78  
-        return
79 77
         if p2pool.DEBUG:
80 78
             print "Bad peer banned:", self.addr
81 79
         self.transport.loseConnection()
26  p2pool/test/test_p2p.py
@@ -5,23 +5,23 @@
5 5
 
6 6
 from p2pool import networks, p2p
7 7
 
8  
-class MyNode(p2p.Node):
9  
-    def __init__(self, df):
10  
-        p2p.Node.__init__(self, lambda: None, 29333, networks.nets['bitcoin'], {}, set([('127.0.0.1', 9333)]), 0, 0, 0, 0)
11  
-        
12  
-        self.id_to_use = random.randrange(2**256)
13  
-        self.df = df
14  
-    
15  
-    def handle_share_hashes(self, hashes, peer):
16  
-        peer.get_shares(
17  
-            hashes=[hashes[0]],
18  
-            parents=5,
19  
-            stops=[],
20  
-        ).chainDeferred(self.df)
21 8
 
22 9
 class Test(unittest.TestCase):
23 10
     @defer.inlineCallbacks
24 11
     def test_sharereq(self):
  12
+        class MyNode(p2p.Node):
  13
+            def __init__(self, df):
  14
+                p2p.Node.__init__(self, lambda: None, 29333, networks.nets['bitcoin'], {}, set([('127.0.0.1', 9333)]), 0, 0, 0, 0)
  15
+                
  16
+                self.df = df
  17
+            
  18
+            def handle_share_hashes(self, hashes, peer):
  19
+                peer.get_shares(
  20
+                    hashes=[hashes[0]],
  21
+                    parents=5,
  22
+                    stops=[],
  23
+                ).chainDeferred(self.df)
  24
+        
25 25
         df = defer.Deferred()
26 26
         n = MyNode(df)
27 27
         n.start()
2  p2pool/util/p2protocol.py
@@ -67,7 +67,7 @@ def dataReceiver(self):
67 67
             except:
68 68
                 print 'RECV', command, payload[:100].encode('hex') + ('...' if len(payload) > 100 else '')
69 69
                 log.err(None, 'Error handling message: (see RECV line)')
70  
-                self.badPeerHappened()
  70
+                self.transport.loseConnection()
71 71
     
72 72
     def packetReceived(self, command, payload2):
73 73
         handler = getattr(self, 'handle_' + command, None)

No commit comments for this range

Something went wrong with that request. Please try again.