From 52e15aa4d067fc4ace12c80be5c82e85c04fcfec Mon Sep 17 00:00:00 2001 From: John Newbery Date: Wed, 29 Mar 2017 14:07:39 -0400 Subject: Adds helper functions to NodeConnCB This commit adds some helper functions to NodeConnCB which are useful for many tests: - NodeConnCB now keeps track of the number of each message type that it's received and the most recent message of each type. Many tests assert on the most recent block, tx or reject message. - NodeConnCB now keeps track of its connection state by setting a connected boolean in on_open() and on_close() - NodeConnCB now has wait_for_block, wait_for_getdata, wait_for_getheaders, wait_for_inv and wait_for_verack methods I have updated the individual test cases to make sure that there are no namespace problems that cause them to fail with these new definitions. Future commits will remove the duplicate code. --- test/functional/maxuploadtarget.py | 9 --------- 1 file changed, 9 deletions(-) (limited to 'test/functional/maxuploadtarget.py') diff --git a/test/functional/maxuploadtarget.py b/test/functional/maxuploadtarget.py index 9b42bf276c..696933512e 100755 --- a/test/functional/maxuploadtarget.py +++ b/test/functional/maxuploadtarget.py @@ -44,15 +44,6 @@ class TestNode(NodeConnCB): except KeyError as e: self.block_receive_map[message.block.sha256] = 1 - # Spin until verack message is received from the node. - # We use this to signal that our test can begin. This - # is called from the testing thread, so it needs to acquire - # the global lock. - def wait_for_verack(self): - def veracked(): - return self.verack_received - return wait_until(veracked, timeout=10) - def wait_for_disconnect(self): def disconnected(): return self.peer_disconnected -- cgit v1.2.3