Skip to content

Commit 7ee5236

Browse files
author
MarcoFalke
committed
Merge #10365: [tests] increase timeouts in sendheaders test
56befa0 [tests] increase timeouts in sendheaders test (John Newbery) b0bfa23 [tests] Make wait_until timeout 60 seconds by default (John Newbery) Tree-SHA512: ca68ad91a7cabb0673f230631a9f2196a4a394cf7cea7a266b3dad3923f7887d2a192ceedd68f7a4a06d105a7d13870e75e971193b93476f8d72b34639d7c3d1
2 parents daf3e7d + 56befa0 commit 7ee5236

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

test/functional/sendheaders.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def run_test(self):
243243
if i == 0:
244244
# first request the block
245245
test_node.get_data([tip])
246-
test_node.wait_for_block(tip, timeout=5)
246+
test_node.wait_for_block(tip)
247247
elif i == 1:
248248
# next try requesting header and block
249249
test_node.get_headers(locator=[old_tip], hashstop=tip)
@@ -258,7 +258,7 @@ def run_test(self):
258258
new_block = create_block(tip, create_coinbase(height+1), block_time)
259259
new_block.solve()
260260
test_node.send_header_for_blocks([new_block])
261-
test_node.wait_for_getdata([new_block.sha256], timeout=5)
261+
test_node.wait_for_getdata([new_block.sha256])
262262
test_node.send_message(msg_block(new_block))
263263
test_node.sync_with_ping() # make sure this block is processed
264264
inv_node.clear_last_announcement()
@@ -297,18 +297,18 @@ def run_test(self):
297297
if j == 0:
298298
# Announce via inv
299299
test_node.send_block_inv(tip)
300-
test_node.wait_for_getheaders(timeout=5)
300+
test_node.wait_for_getheaders()
301301
# Should have received a getheaders now
302302
test_node.send_header_for_blocks(blocks)
303303
# Test that duplicate inv's won't result in duplicate
304304
# getdata requests, or duplicate headers announcements
305305
[ inv_node.send_block_inv(x.sha256) for x in blocks ]
306-
test_node.wait_for_getdata([x.sha256 for x in blocks], timeout=5)
306+
test_node.wait_for_getdata([x.sha256 for x in blocks])
307307
inv_node.sync_with_ping()
308308
else:
309309
# Announce via headers
310310
test_node.send_header_for_blocks(blocks)
311-
test_node.wait_for_getdata([x.sha256 for x in blocks], timeout=5)
311+
test_node.wait_for_getdata([x.sha256 for x in blocks])
312312
# Test that duplicate headers won't result in duplicate
313313
# getdata requests (the check is further down)
314314
inv_node.send_header_for_blocks(blocks)
@@ -495,7 +495,7 @@ def run_test(self):
495495
with mininode_lock:
496496
test_node.last_message.pop("getheaders", None)
497497
test_node.send_header_for_blocks([blocks[1]])
498-
test_node.wait_for_getheaders(timeout=1)
498+
test_node.wait_for_getheaders()
499499
test_node.send_header_for_blocks(blocks)
500500
test_node.wait_for_getdata([x.sha256 for x in blocks])
501501
[ test_node.send_message(msg_block(x)) for x in blocks ]
@@ -518,7 +518,7 @@ def run_test(self):
518518
with mininode_lock:
519519
test_node.last_message.pop("getheaders", None)
520520
test_node.send_header_for_blocks([blocks[i]])
521-
test_node.wait_for_getheaders(timeout=1)
521+
test_node.wait_for_getheaders()
522522

523523
# Next header will connect, should re-set our count:
524524
test_node.send_header_for_blocks([blocks[0]])
@@ -533,7 +533,7 @@ def run_test(self):
533533
with mininode_lock:
534534
test_node.last_message.pop("getheaders", None)
535535
test_node.send_header_for_blocks([blocks[i%len(blocks)]])
536-
test_node.wait_for_getheaders(timeout=1)
536+
test_node.wait_for_getheaders()
537537

538538
# Eventually this stops working.
539539
test_node.send_header_for_blocks([blocks[-1]])

test/functional/test_framework/mininode.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,8 @@ def __repr__(self):
13581358

13591359
# Helper function
13601360
def wait_until(predicate, *, attempts=float('inf'), timeout=float('inf')):
1361+
if attempts == float('inf') and timeout == float('inf'):
1362+
timeout = 60
13611363
attempt = 0
13621364
elapsed = 0
13631365

0 commit comments

Comments
 (0)