From 6b5d3edae367d9cffae7aaba8c4c638e97812f38 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Wed, 22 Jan 2020 13:35:47 +0300 Subject: [PATCH] Fix dip4-coinbasemerkleroots.py race condition (#3297) Sometimes the node we ask for mnlistdiff is so fast to reply that we receive the message back before we reset `last_mnlistdiff`. To fix this we should reset it before sending the message, not after. --- test/functional/dip4-coinbasemerkleroots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functional/dip4-coinbasemerkleroots.py b/test/functional/dip4-coinbasemerkleroots.py index 0a86f5c466..ffca483df0 100755 --- a/test/functional/dip4-coinbasemerkleroots.py +++ b/test/functional/dip4-coinbasemerkleroots.py @@ -24,13 +24,13 @@ class TestNode(NodeConnCB): self.last_mnlistdiff = message def wait_for_mnlistdiff(self, timeout=30): - self.last_mnlistdiff = None def received_mnlistdiff(): return self.last_mnlistdiff is not None return wait_until(received_mnlistdiff, timeout=timeout) def getmnlistdiff(self, baseBlockHash, blockHash): msg = msg_getmnlistd(baseBlockHash, blockHash) + self.last_mnlistdiff = None self.send_message(msg) self.wait_for_mnlistdiff() return self.last_mnlistdiff