mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
[tests] in zmq test, timeout if message not received
This commit is contained in:
parent
5ebd5f9e15
commit
b1bac1cb7e
@ -36,6 +36,7 @@ class ZMQTest (BitcoinTestFramework):
|
|||||||
|
|
||||||
self.zmqContext = zmq.Context()
|
self.zmqContext = zmq.Context()
|
||||||
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
|
self.zmqSubSocket = self.zmqContext.socket(zmq.SUB)
|
||||||
|
self.zmqSubSocket.set(zmq.RCVTIMEO, 60000)
|
||||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
|
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashblock")
|
||||||
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
|
self.zmqSubSocket.setsockopt(zmq.SUBSCRIBE, b"hashtx")
|
||||||
ip_address = "tcp://127.0.0.1:28332"
|
ip_address = "tcp://127.0.0.1:28332"
|
||||||
@ -94,11 +95,10 @@ class ZMQTest (BitcoinTestFramework):
|
|||||||
msg = self.zmqSubSocket.recv_multipart()
|
msg = self.zmqSubSocket.recv_multipart()
|
||||||
topic = msg[0]
|
topic = msg[0]
|
||||||
body = msg[1]
|
body = msg[1]
|
||||||
hashZMQ = ""
|
assert_equal(topic, b"hashtx")
|
||||||
if topic == b"hashtx":
|
hashZMQ = bytes_to_hex_str(body)
|
||||||
hashZMQ = bytes_to_hex_str(body)
|
msgSequence = struct.unpack('<I', msg[-1])[-1]
|
||||||
msgSequence = struct.unpack('<I', msg[-1])[-1]
|
assert_equal(msgSequence, blockcount + 1)
|
||||||
assert_equal(msgSequence, blockcount + 1)
|
|
||||||
|
|
||||||
assert_equal(hashRPC, hashZMQ) # txid from sendtoaddress must be equal to the hash received over zmq
|
assert_equal(hashRPC, hashZMQ) # txid from sendtoaddress must be equal to the hash received over zmq
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user