-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #6189: backport: bitcoin#16333, #21862, #22385, #22550, #22597,…
… #22632, #22718, #22907 - fire up test chains by first block - 2/n e4e7c44 fix: use proper chain instead using ActiveChain for test framework (Konstantin Akimov) 65b92fa Merge bitcoin/bitcoin#21862: test: Set regtest.BIP65Height = 111 to speed up tests (fanquake) adcf095 Merge bitcoin/bitcoin#22718: doc: Add missing PR 16333 release note (MarcoFalke) 101a863 Merge bitcoin/bitcoin#16333: test: Set BIP34Height = 2 for regtest (MarcoFalke) 71af881 Merge bitcoin/bitcoin#22907: test: Avoid intermittent test failure in feature_csv_activation.py (merge-script) fc25503 Merge bitcoin/bitcoin#22632: test: Set regtest.BIP66Height = 102 to speed up tests (W. J. van der Laan) cbd2be8 Merge bitcoin/bitcoin#22597: consensus/params: simplify ValidDeployment check to avoid gcc warning (MarcoFalke) 8928146 Merge bitcoin/bitcoin#22550: test: improve `test_signing_with_{csv,cltv}` subtests (speed, prevent timeout) (MarcoFalke) fb00431 Merge bitcoin/bitcoin#22385: refactor: Use DeploymentEnabled to hide VB deployments (MarcoFalke) Pull request description: ## Issue being fixed or feature implemented Backports from bitcoin related to hard-fork mechanism and accelerated action ## What was done? see commits for backports. Also fixed an issue of using from ChainState on RegTest: should be used specified chain, not the "best chain". ## How Has This Been Tested? Run unit & functional tests ## Breaking Changes That's a breaking changes for RegTest ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone ACKs for top commit: PastaPastaPasta: utACK e4e7c44 Tree-SHA512: c02813179177781a0da3beaff65732e12017f0056565b897891b2c5a06fda125a4e032571a02fad9d8640728df82c117393bd78bc6d406e0a30f72587b2d7344
- Loading branch information
Showing
17 changed files
with
100 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Tests | ||
----- | ||
|
||
- For the `regtest` network the activation heights of several softforks were | ||
changed. (dash#6189) | ||
* BIP 34 (blockheight in coinbase) from 500 to 2 | ||
* BIP 66 (DERSIG) from 1251 to 102 | ||
* BIP 65 (CLTV) from 1351 to 111 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ | |
from itertools import product | ||
|
||
from test_framework.blocktools import ( | ||
CSV_ACTIVATION_HEIGHT, | ||
create_block, | ||
create_coinbase, | ||
TIME_GENESIS_BLOCK, | ||
|
@@ -63,12 +64,12 @@ | |
TESTING_TX_COUNT = 83 # Number of testing transactions: 1 BIP113 tx, 16 BIP68 txs, 66 BIP112 txs (see comments above) | ||
COINBASE_BLOCK_COUNT = TESTING_TX_COUNT # Number of coinbase blocks we need to generate as inputs for our txs | ||
BASE_RELATIVE_LOCKTIME = 10 | ||
CSV_ACTIVATION_HEIGHT = 432 | ||
SEQ_DISABLE_FLAG = 1 << 31 | ||
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] | ||
|
||
|
@@ -93,6 +95,7 @@ def set_test_params(self): | |
self.setup_clean_chain = True | ||
# Must set '-dip3params=2000:2000' to create pre-dip3 blocks only | ||
self.extra_args = [[ | ||
'-peertimeout=999999', # bump because mocktime might cause a disconnect otherwise | ||
'[email protected]', | ||
'-dip3params=2000:2000', | ||
'-par=1', # Use only one script thread to get the exact reject reason for testing | ||
|
@@ -148,13 +151,13 @@ def create_bip112txs(self, bip112inputs, varyOP_CSV, txversion, locktime_delta=0 | |
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))) | ||
|
@@ -201,7 +204,7 @@ def run_test(self): | |
self.tip = int(self.nodes[0].getbestblockhash(), 16) | ||
|
||
# Activation height is hardcoded | ||
test_blocks = self.generate_blocks(CSV_ACTIVATION_HEIGHT-5 - COINBASE_BLOCK_COUNT) | ||
test_blocks = self.generate_blocks(CSV_ACTIVATION_HEIGHT - 5 - COINBASE_BLOCK_COUNT) | ||
#test_blocks = self.generate_blocks(345) | ||
self.send_blocks(test_blocks) | ||
assert not softfork_active(self.nodes[0], 'csv') | ||
|
@@ -487,5 +490,6 @@ def run_test(self): | |
self.send_blocks([self.create_test_block(time_txs)]) | ||
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash()) | ||
|
||
|
||
if __name__ == '__main__': | ||
BIP68_112_113Test().main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.