Skip to content

Commit ef21fb7

Browse files
committed
zmq test: speedup test by whitelisting peers (immediate tx relay)
Speeds up the zmq test roughly by a factor of 2x (~20 sec. instead of ~40 sec.) and also avoids timeouts on the synchronization methods (sync_mempool() / sync_blocks()) that happened with a slight chance. This is due to the fact that there is no upper bound on the trickle relay time, so even the default of 60s is sometimes too low. Fixed by enabling immediate tx relay on node1.
1 parent 5c65463 commit ef21fb7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/functional/interface_zmq.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ def set_test_params(self):
6767
self.num_nodes = 2
6868
if self.is_wallet_compiled():
6969
self.requires_wallet = True
70+
# This test isn't testing txn relay/timing, so set whitelist on the
71+
# peers for instant txn relay. This speeds up the test run time 2-3x.
72+
self.extra_args = [["[email protected]"]] * self.num_nodes
7073

7174
def skip_test_if_missing_module(self):
7275
self.skip_if_no_py3_zmq()
@@ -93,7 +96,8 @@ def setup_zmq_test(self, services, *, recv_timeout=60, sync_blocks=True):
9396
socket = self.ctx.socket(zmq.SUB)
9497
subscribers.append(ZMQSubscriber(socket, topic.encode()))
9598

96-
self.restart_node(0, ["-zmqpub%s=%s" % (topic, address) for topic, address in services])
99+
self.restart_node(0, ["-zmqpub%s=%s" % (topic, address) for topic, address in services] +
100+
self.extra_args[0])
97101

98102
for i, sub in enumerate(subscribers):
99103
sub.socket.connect(services[i][1])

0 commit comments

Comments
 (0)