Fix p2p-fingerprint.py

This commit is contained in:
UdjinM6 2019-05-21 17:03:44 +03:00 committed by Pasta
parent 92fed92540
commit 6f91144f22
No known key found for this signature in database
GPG Key ID: 0B8EB7A31A44D9C6

View File

@ -16,7 +16,7 @@ from test_framework.mininode import (
CInv, CInv,
NetworkThread, NetworkThread,
NodeConn, NodeConn,
SingleNodeConnCB, NodeConnCB,
msg_headers, msg_headers,
msg_block, msg_block,
msg_getdata, msg_getdata,
@ -90,14 +90,14 @@ class P2PFingerprintTest(BitcoinTestFramework):
# last month but that have over a month's worth of work are also withheld. # last month but that have over a month's worth of work are also withheld.
def run_test(self): def run_test(self):
# TODO remove this when mininode is up-to-date with Bitcoin # TODO remove this when mininode is up-to-date with Bitcoin
class MyNodeConnCB(SingleNodeConnCB): class MyNodeConnCB(NodeConnCB):
def __init__(self): def __init__(self):
SingleNodeConnCB.__init__(self) super().__init__()
self.cond = threading.Condition() self.cond = threading.Condition()
self.last_message = {} self.last_message = {}
def deliver(self, conn, message): def deliver(self, conn, message):
SingleNodeConnCB.deliver(self, conn, message) super().deliver(conn, message)
command = message.command.decode('ascii') command = message.command.decode('ascii')
self.last_message[command] = message self.last_message[command] = message
with self.cond: with self.cond: