Skip to content

Commit 6e9e39d

Browse files
committed
test: Don't use v2transport when it's too slow.
Sending multiple large messages is rather slow with the non-optimized python implementation of ChaCha20. Apart from the slowness, these tests would also run successfully with v2.
1 parent 87549c8 commit 6e9e39d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

test/functional/feature_block.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,10 @@ def run_test(self):
12631263
b89a = self.update_block("89a", [tx])
12641264
self.send_blocks([b89a], success=False, reject_reason='bad-txns-inputs-missingorspent', reconnect=True)
12651265

1266+
# Don't use v2transport for the large reorg, which is too slow with the unoptimized python ChaCha20 implementation
1267+
if self.options.v2transport:
1268+
self.nodes[0].disconnect_p2ps()
1269+
self.helper_peer = self.nodes[0].add_p2p_connection(P2PDataStore(), supports_v2_p2p=False)
12661270
self.log.info("Test a re-org of one week's worth of blocks (1088 blocks)")
12671271

12681272
self.move_tip(88)

test/functional/feature_maxuploadtarget.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def run_test(self):
6767
p2p_conns = []
6868

6969
for _ in range(3):
70-
p2p_conns.append(self.nodes[0].add_p2p_connection(TestP2PConn()))
70+
# Don't use v2transport in this test (too slow with the unoptimized python ChaCha20 implementation)
71+
p2p_conns.append(self.nodes[0].add_p2p_connection(TestP2PConn(), supports_v2_p2p=False))
7172

7273
# Now mine a big block
7374
mine_large_block(self, self.wallet, self.nodes[0])
@@ -148,7 +149,7 @@ def run_test(self):
148149
self.restart_node(0, ["[email protected]", "-maxuploadtarget=1"])
149150

150151
# Reconnect to self.nodes[0]
151-
peer = self.nodes[0].add_p2p_connection(TestP2PConn())
152+
peer = self.nodes[0].add_p2p_connection(TestP2PConn(), supports_v2_p2p=False)
152153

153154
#retrieve 20 blocks which should be enough to break the 1MB limit
154155
getdata_request.inv = [CInv(MSG_BLOCK, big_new_block)]

test/functional/p2p_invalid_messages.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,10 @@ def test_noncontinuous_headers_msg(self):
327327

328328
def test_resource_exhaustion(self):
329329
self.log.info("Test node stays up despite many large junk messages")
330-
conn = self.nodes[0].add_p2p_connection(P2PDataStore())
331-
conn2 = self.nodes[0].add_p2p_connection(P2PDataStore())
330+
# Don't use v2 here - the non-optimised encryption would take too long to encrypt
331+
# the large messages
332+
conn = self.nodes[0].add_p2p_connection(P2PDataStore(), supports_v2_p2p=False)
333+
conn2 = self.nodes[0].add_p2p_connection(P2PDataStore(), supports_v2_p2p=False)
332334
msg_at_size = msg_unrecognized(str_data="b" * VALID_DATA_LIMIT)
333335
assert len(msg_at_size.serialize()) == MAX_PROTOCOL_MESSAGE_LENGTH
334336

0 commit comments

Comments
 (0)