aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormerge-script <falke.marco@gmail.com>2021-09-10 10:02:03 +0200
committermerge-script <falke.marco@gmail.com>2021-09-10 10:02:03 +0200
commit60881158c8010e436e3c107a2d62ffb7aa23220c (patch)
treeac7ba18e3d67c08cfda911ec4686874a78529be8 /test
parentb8336b22d30d628b9324d7b9e4fe12d7f9ec5bb8 (diff)
parentfa676dbac87919061de9f82bce65e373e8d85bd1 (diff)
Merge bitcoin/bitcoin#22907: test: Avoid intermittent test failure in feature_csv_activation.py
fa676dbac87919061de9f82bce65e373e8d85bd1 test: pep-8 whitespace (MarcoFalke) faed284eabb250a07331dfca22bb8f96a95c72ea 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 fa676dbac87919061de9f82bce65e373e8d85bd1 Tree-SHA512: 061c0585a805aa2f8e55c4beedd4b8498a2951f33d60aa3632dda0a284db3a627d14a23dbd57e8a66c69a1612f39418e3a755c8ca97f6ae1105c0d70f0d1a801
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/feature_csv_activation.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/functional/feature_csv_activation.py b/test/functional/feature_csv_activation.py
index eca2acef1c..2bfe22267b 100755
--- a/test/functional/feature_csv_activation.py
+++ b/test/functional/feature_csv_activation.py
@@ -69,6 +69,7 @@ SEQ_RANDOM_HIGH_BIT = 1 << 25
SEQ_TYPE_FLAG = 1 << 22
SEQ_RANDOM_LOW_BIT = 1 << 18
+
def relative_locktime(sdf, srhb, stf, srlb):
"""Returns a locktime with certain bits set."""
@@ -83,6 +84,7 @@ def relative_locktime(sdf, srhb, stf, srlb):
locktime |= SEQ_RANDOM_LOW_BIT
return locktime
+
def all_rlt_txs(txs):
return [tx['tx'] for tx in txs]
@@ -92,6 +94,7 @@ class BIP68_112_113Test(BitcoinTestFramework):
self.num_nodes = 1
self.setup_clean_chain = True
self.extra_args = [[
+ '-peertimeout=999999', # bump because mocktime might cause a disconnect otherwise
'-whitelist=noban@127.0.0.1',
'-par=1', # Use only one script thread to get the exact reject reason for testing
]]
@@ -143,13 +146,13 @@ class BIP68_112_113Test(BitcoinTestFramework):
for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)):
locktime = relative_locktime(sdf, srhb, stf, srlb)
tx = self.create_self_transfer_from_utxo(bip112inputs[i])
- if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed
+ if varyOP_CSV: # if varying OP_CSV, nSequence is fixed
tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta
else: # vary nSequence instead, OP_CSV is fixed
tx.vin[0].nSequence = locktime + locktime_delta
tx.nVersion = txversion
self.miniwallet.sign_tx(tx)
- if (varyOP_CSV):
+ if varyOP_CSV:
tx.vin[0].scriptSig = CScript([locktime, OP_CHECKSEQUENCEVERIFY, OP_DROP] + list(CScript(tx.vin[0].scriptSig)))
else:
tx.vin[0].scriptSig = CScript([BASE_RELATIVE_LOCKTIME, OP_CHECKSEQUENCEVERIFY, OP_DROP] + list(CScript(tx.vin[0].scriptSig)))
@@ -197,7 +200,7 @@ class BIP68_112_113Test(BitcoinTestFramework):
# Activation height is hardcoded
# We advance to block height five below BIP112 activation for the following tests
- test_blocks = self.generate_blocks(CSV_ACTIVATION_HEIGHT-5 - COINBASE_BLOCK_COUNT)
+ test_blocks = self.generate_blocks(CSV_ACTIVATION_HEIGHT - 5 - COINBASE_BLOCK_COUNT)
self.send_blocks(test_blocks)
assert not softfork_active(self.nodes[0], 'csv')
@@ -482,5 +485,6 @@ class BIP68_112_113Test(BitcoinTestFramework):
self.send_blocks([self.create_test_block(time_txs)])
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
+
if __name__ == '__main__':
BIP68_112_113Test().main()