Skip to content

Commit fad4f44

Browse files
author
MarcoFalke
committed
test: Set peertimeout in write_config
This avoids having to remember to set it whenever mocktime is used with peer connections. Also, it might help avoiding disconnects when attaching a debugger to a running test.
1 parent 053a5fc commit fad4f44

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

test/functional/feature_bip68_sequence.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ class BIP68Test(BitcoinTestFramework):
4141
def set_test_params(self):
4242
self.num_nodes = 2
4343
self.extra_args = [
44-
[
45-
"-acceptnonstdtxn=1",
46-
"-peertimeout=9999", # bump because mocktime might cause a disconnect otherwise
47-
],
44+
["-acceptnonstdtxn=1"],
4845
["-acceptnonstdtxn=0"],
4946
]
5047

test/functional/feature_csv_activation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def set_test_params(self):
9494
self.num_nodes = 1
9595
self.setup_clean_chain = True
9696
self.extra_args = [[
97-
'-peertimeout=999999', # bump because mocktime might cause a disconnect otherwise
9897
9998
'-par=1', # Use only one script thread to get the exact reject reason for testing
10099
]]

test/functional/feature_maxuploadtarget.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def set_test_params(self):
3838
self.extra_args = [[
3939
"-maxuploadtarget=800",
4040
"-acceptnonstdtxn=1",
41-
"-peertimeout=9999", # bump because mocktime might cause a disconnect otherwise
4241
]]
4342
self.supports_cli = False
4443

test/functional/test_framework/util.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ def write_config(config_path, *, n, chain, extra_config="", disable_autoconnect=
364364
f.write("dnsseed=0\n")
365365
f.write("fixedseeds=0\n")
366366
f.write("listenonion=0\n")
367+
# Increase peertimeout to avoid disconnects while using mocktime.
368+
# peertimeout is measured in wall clock time, so setting it to the
369+
# duration of the longest test is sufficient. It can be overriden in
370+
# tests.
371+
f.write("peertimeout=999999\n")
367372
f.write("printtoconsole=0\n")
368373
f.write("upnp=0\n")
369374
f.write("natpmp=0\n")

0 commit comments

Comments
 (0)