Skip to content

Commit 6088115

Browse files
author
merge-script
committed
Merge bitcoin/bitcoin#22907: test: Avoid intermittent test failure in feature_csv_activation.py
fa676db test: pep-8 whitespace (MarcoFalke) faed284 test: Avoid intermittent test failure in feature_csv_activation.py (MarcoFalke) Pull request description: Otherwise there will be disconnects if the test runs longer than the default peertimeout (60s): ``` node0 2021-09-05T20:28:30.973116Z (mocktime: 2021-09-01T07:17:29Z) [net] [net.cpp:1323] [InactivityCheck] socket receive timeout: 393061s peer=0 ``` Fix that by skipping `InactivityCheck` via a large `-peertimeout`. ACKs for top commit: fanquake: ACK fa676db Tree-SHA512: 061c0585a805aa2f8e55c4beedd4b8498a2951f33d60aa3632dda0a284db3a627d14a23dbd57e8a66c69a1612f39418e3a755c8ca97f6ae1105c0d70f0d1a801
2 parents b8336b2 + fa676db commit 6088115

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test/functional/feature_csv_activation.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
SEQ_TYPE_FLAG = 1 << 22
7070
SEQ_RANDOM_LOW_BIT = 1 << 18
7171

72+
7273
def relative_locktime(sdf, srhb, stf, srlb):
7374
"""Returns a locktime with certain bits set."""
7475

@@ -83,6 +84,7 @@ def relative_locktime(sdf, srhb, stf, srlb):
8384
locktime |= SEQ_RANDOM_LOW_BIT
8485
return locktime
8586

87+
8688
def all_rlt_txs(txs):
8789
return [tx['tx'] for tx in txs]
8890

@@ -92,6 +94,7 @@ def set_test_params(self):
9294
self.num_nodes = 1
9395
self.setup_clean_chain = True
9496
self.extra_args = [[
97+
'-peertimeout=999999', # bump because mocktime might cause a disconnect otherwise
9598
9699
'-par=1', # Use only one script thread to get the exact reject reason for testing
97100
]]
@@ -143,13 +146,13 @@ def create_bip112txs(self, bip112inputs, varyOP_CSV, txversion, locktime_delta=0
143146
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)):
144147
locktime = relative_locktime(sdf, srhb, stf, srlb)
145148
tx = self.create_self_transfer_from_utxo(bip112inputs[i])
146-
if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed
149+
if varyOP_CSV: # if varying OP_CSV, nSequence is fixed
147150
tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta
148151
else: # vary nSequence instead, OP_CSV is fixed
149152
tx.vin[0].nSequence = locktime + locktime_delta
150153
tx.nVersion = txversion
151154
self.miniwallet.sign_tx(tx)
152-
if (varyOP_CSV):
155+
if varyOP_CSV:
153156
tx.vin[0].scriptSig = CScript([locktime, OP_CHECKSEQUENCEVERIFY, OP_DROP] + list(CScript(tx.vin[0].scriptSig)))
154157
else:
155158
tx.vin[0].scriptSig = CScript([BASE_RELATIVE_LOCKTIME, OP_CHECKSEQUENCEVERIFY, OP_DROP] + list(CScript(tx.vin[0].scriptSig)))
@@ -197,7 +200,7 @@ def run_test(self):
197200

198201
# Activation height is hardcoded
199202
# We advance to block height five below BIP112 activation for the following tests
200-
test_blocks = self.generate_blocks(CSV_ACTIVATION_HEIGHT-5 - COINBASE_BLOCK_COUNT)
203+
test_blocks = self.generate_blocks(CSV_ACTIVATION_HEIGHT - 5 - COINBASE_BLOCK_COUNT)
201204
self.send_blocks(test_blocks)
202205
assert not softfork_active(self.nodes[0], 'csv')
203206

@@ -482,5 +485,6 @@ def run_test(self):
482485
self.send_blocks([self.create_test_block(time_txs)])
483486
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
484487

488+
485489
if __name__ == '__main__':
486490
BIP68_112_113Test().main()

0 commit comments

Comments
 (0)