mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
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.
This commit is contained in:
parent
a8213cadb9
commit
6b5d3edae3
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user