diff options
author | Troy Giorshev <troygiorshev@gmail.com> | 2020-07-27 07:55:49 -0400 |
---|---|---|
committer | Troy Giorshev <troygiorshev@gmail.com> | 2020-07-27 07:55:49 -0400 |
commit | 2c6a02e0248825e205e6deea4c38409044feb4ab (patch) | |
tree | 669a1f817742f977dcc0343cd781a5c05ef5e07a | |
parent | 31d2b4098a9e4ee9a694ba1ad42829637cbcf3c6 (diff) | |
download | bitcoin-2c6a02e0248825e205e6deea4c38409044feb4ab.tar.xz |
Clean message_count and last_message
This commit clarifies the intended usage of message_count and
last_message. Additionally it changes the only usage of message_count
to using last_message instead, bringing the code further along the
intended usage.
-rwxr-xr-x | test/functional/test_framework/mininode.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py index f68c1a9ddd..07811667a8 100755 --- a/test/functional/test_framework/mininode.py +++ b/test/functional/test_framework/mininode.py @@ -283,9 +283,13 @@ class P2PInterface(P2PConnection): def __init__(self): super().__init__() - # Track number of messages of each type received and the most recent - # message of each type + # Track number of messages of each type received. + # Should be read-only in a test. self.message_count = defaultdict(int) + + # Track the most recent message of each type. + # To wait for a message to be received, pop that message from + # this and use wait_until. self.last_message = {} # A count of the number of ping messages we've sent to the node @@ -472,7 +476,7 @@ class P2PInterface(P2PConnection): def wait_for_verack(self, timeout=60): def test_function(): - return self.message_count["verack"] + return "verack" in self.last_message self.wait_until(test_function, timeout=timeout) |