Skip to content

Commit c985eb8

Browse files
committed
test: add option to speed up tx relay/mempool sync
when `self.noban_tx_relay=True`, the following flag `-whitelist=noban,in,out@127.0.0.1`is added to `extra_args` to speed up tx relay/mempool sync.
1 parent 66bc6e2 commit c985eb8

31 files changed

+76
-64
lines changed

test/functional/feature_cltv.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,10 @@ def cltv_validate(tx, height):
8383
class BIP65Test(BitcoinTestFramework):
8484
def set_test_params(self):
8585
self.num_nodes = 1
86+
# whitelist peers to speed up tx relay / mempool sync
87+
self.noban_tx_relay = True
8688
self.extra_args = [[
8789
f'-testactivationheight=cltv@{CLTV_HEIGHT}',
88-
'-whitelist=noban@127.0.0.1',
8990
'-par=1', # Use only one script thread to get the exact reject reason for testing
9091
'-acceptnonstdtxn=1', # cltv_invalidate is nonstandard
9192
]]

test/functional/feature_csv_activation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ class BIP68_112_113Test(BitcoinTestFramework):
9595
def set_test_params(self):
9696
self.num_nodes = 1
9797
self.setup_clean_chain = True
98+
# whitelist peers to speed up tx relay / mempool sync
99+
self.noban_tx_relay = True
98100
self.extra_args = [[
99-
'-whitelist=noban@127.0.0.1',
100101
f'-testactivationheight=csv@{CSV_ACTIVATION_HEIGHT}',
101102
'-par=1', # Use only one script thread to get the exact reject reason for testing
102103
]]

test/functional/feature_dersig.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ def unDERify(tx):
4747
class BIP66Test(BitcoinTestFramework):
4848
def set_test_params(self):
4949
self.num_nodes = 1
50+
# whitelist peers to speed up tx relay / mempool sync
51+
self.noban_tx_relay = True
5052
self.extra_args = [[
5153
f'-testactivationheight=dersig@{DERSIG_HEIGHT}',
52-
'-whitelist=noban@127.0.0.1',
5354
'-par=1', # Use only one script thread to get the exact log msg for testing
5455
]]
5556
self.setup_clean_chain = True

test/functional/feature_fee_estimation.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,12 @@ def make_tx(wallet, utxo, feerate):
132132
class EstimateFeeTest(BitcoinTestFramework):
133133
def set_test_params(self):
134134
self.num_nodes = 3
135-
# Force fSendTrickle to true (via whitelist.noban)
135+
# whitelist peers to speed up tx relay / mempool sync
136+
self.noban_tx_relay = True
136137
self.extra_args = [
137-
["-whitelist=noban@127.0.0.1"],
138-
["-whitelist=noban@127.0.0.1", "-blockmaxweight=68000"],
139-
["-whitelist=noban@127.0.0.1", "-blockmaxweight=32000"],
138+
[],
139+
["-blockmaxweight=68000"],
140+
["-blockmaxweight=32000"],
140141
]
141142

142143
def setup_network(self):

test/functional/interface_rest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ def set_test_params(self):
5353
self.num_nodes = 2
5454
self.extra_args = [["-rest", "-blockfilterindex=1"], []]
5555
# whitelist peers to speed up tx relay / mempool sync
56-
for args in self.extra_args:
57-
args.append("-whitelist=noban@127.0.0.1")
56+
self.noban_tx_relay = True
5857
self.supports_cli = False
5958

6059
def test_rest_request(

test/functional/interface_zmq.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ def caused_notification(self, notification):
104104
class ZMQTest (BitcoinTestFramework):
105105
def set_test_params(self):
106106
self.num_nodes = 2
107-
# This test isn't testing txn relay/timing, so set whitelist on the
108-
# peers for instant txn relay. This speeds up the test run time 2-3x.
109-
self.extra_args = [["-whitelist=noban@127.0.0.1"]] * self.num_nodes
107+
# whitelist peers to speed up tx relay / mempool sync
108+
self.noban_tx_relay = True
110109
self.zmq_port_base = p2p_port(self.num_nodes + 1)
111110

112111
def skip_test_if_missing_module(self):
@@ -138,8 +137,7 @@ def setup_zmq_test(self, services, *, recv_timeout=60, sync_blocks=True, ipv6=Fa
138137
socket.setsockopt(zmq.IPV6, 1)
139138
subscribers.append(ZMQSubscriber(socket, topic.encode()))
140139

141-
self.restart_node(0, [f"-zmqpub{topic}={address}" for topic, address in services] +
142-
self.extra_args[0])
140+
self.restart_node(0, [f"-zmqpub{topic}={address}" for topic, address in services])
143141

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

test/functional/mempool_packages.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
class MempoolPackagesTest(BitcoinTestFramework):
2828
def set_test_params(self):
2929
self.num_nodes = 2
30+
# whitelist peers to speed up tx relay / mempool sync
31+
self.noban_tx_relay = True
3032
self.extra_args = [
3133
[
3234
"-maxorphantx=1000",
33-
"-whitelist=noban@127.0.0.1", # immediate tx relay
3435
],
3536
[
3637
"-maxorphantx=1000",

test/functional/p2p_feefilter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ def clear_invs(self):
4646
class FeeFilterTest(BitcoinTestFramework):
4747
def set_test_params(self):
4848
self.num_nodes = 2
49+
# whitelist peers to speed up tx relay / mempool sync
50+
self.noban_tx_relay = True
4951
# We lower the various required feerates for this test
5052
# to catch a corner-case where feefilter used to slightly undercut
5153
# mempool and wallet feerate calculation based on GetFee
5254
# rounding down 3 places, leading to stranded transactions.
5355
# See issue #16499
54-
# grant noban permission to all peers to speed up tx relay / mempool sync
5556
self.extra_args = [[
5657
"-minrelaytxfee=0.00000100",
57-
"-mintxfee=0.00000100",
58-
"-whitelist=noban@127.0.0.1",
58+
"-mintxfee=0.00000100"
5959
]] * self.num_nodes
6060

6161
def run_test(self):

test/functional/p2p_filter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ def merkleblock_received(self, value):
9494
class FilterTest(BitcoinTestFramework):
9595
def set_test_params(self):
9696
self.num_nodes = 1
97+
# whitelist peers to speed up tx relay / mempool sync
98+
self.noban_tx_relay = True
9799
self.extra_args = [[
98100
'-peerbloomfilters',
99-
'-whitelist=noban@127.0.0.1', # immediate tx relay
100101
]]
101102

102103
def generatetoscriptpubkey(self, scriptpubkey):

test/functional/p2p_invalid_block.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class InvalidBlockRequestTest(BitcoinTestFramework):
3232
def set_test_params(self):
3333
self.num_nodes = 1
3434
self.setup_clean_chain = True
35-
self.extra_args = [["-whitelist=noban@127.0.0.1"]]
35+
# whitelist peers to speed up tx relay / mempool sync
36+
self.noban_tx_relay = True
3637

3738
def run_test(self):
3839
# Add p2p connection to node0

0 commit comments

Comments
 (0)