Adds helper functions to NodeConnCB
commit52e15aa4d067fc4ace12c80be5c82e85c04fcfec
authorJohn Newbery <john@johnnewbery.com>
Wed, 29 Mar 2017 18:07:39 +0000 (29 14:07 -0400)
committerJohn Newbery <john@johnnewbery.com>
Tue, 18 Apr 2017 19:25:01 +0000 (18 15:25 -0400)
treea8cc190981446a60e8c0189890cd986e8287cbc8
parent2584925077f9658b3953ad931b74779006e59807
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
test/functional/p2p-acceptblock.py
test/functional/p2p-leaktests.py
test/functional/p2p-mempool.py
test/functional/test_framework/comptool.py
test/functional/test_framework/mininode.py