diff --git a/src/chainparams.cpp b/src/chainparams.cpp --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -113,14 +113,6 @@ consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; - // Deployment of BIP68, BIP112, and BIP113. - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; - // May 1st, 2016 - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = - 1462060800; - // May 1st, 2017 - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; - // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S( "000000000000000000000000000000000000000000a0f3064330647e2f6c4828"); @@ -290,14 +282,6 @@ consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; - // Deployment of BIP68, BIP112, and BIP113. - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; - // March 1st, 2016 - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = - 1456790400; - // May 1st, 2017 - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; - // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S( "00000000000000000000000000000000000000000000002a650f6ff7649485da"); @@ -422,10 +406,6 @@ consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 999999999999ULL; - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0; - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 0; - consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = - 999999999999ULL; // The best chain should have at least this much work. consensus.nMinimumChainWork = uint256S("0x00"); diff --git a/src/consensus/params.h b/src/consensus/params.h --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -15,8 +15,6 @@ enum DeploymentPos { DEPLOYMENT_TESTDUMMY, - // Deployment of BIP68, BIP112, and BIP113. - DEPLOYMENT_CSV, // NOTE: Also add new deployments to VersionBitsDeploymentInfo in // versionbits.cpp MAX_VERSION_BITS_DEPLOYMENTS diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1187,52 +1187,6 @@ return rv; } -static UniValue BIP9SoftForkDesc(const Consensus::Params &consensusParams, - Consensus::DeploymentPos id) { - UniValue rv(UniValue::VOBJ); - const ThresholdState thresholdState = - VersionBitsTipState(consensusParams, id); - switch (thresholdState) { - case THRESHOLD_DEFINED: - rv.push_back(Pair("status", "defined")); - break; - case THRESHOLD_STARTED: - rv.push_back(Pair("status", "started")); - break; - case THRESHOLD_LOCKED_IN: - rv.push_back(Pair("status", "locked_in")); - break; - case THRESHOLD_ACTIVE: - rv.push_back(Pair("status", "active")); - break; - case THRESHOLD_FAILED: - rv.push_back(Pair("status", "failed")); - break; - } - if (THRESHOLD_STARTED == thresholdState) { - rv.push_back(Pair("bit", consensusParams.vDeployments[id].bit)); - } - rv.push_back( - Pair("startTime", consensusParams.vDeployments[id].nStartTime)); - rv.push_back(Pair("timeout", consensusParams.vDeployments[id].nTimeout)); - rv.push_back( - Pair("since", VersionBitsTipStateSinceHeight(consensusParams, id))); - return rv; -} - -void BIP9SoftForkDescPushBack(UniValue &bip9_softforks, const std::string &name, - const Consensus::Params &consensusParams, - Consensus::DeploymentPos id) { - // Deployments with timeout value of 0 are hidden. - // A timeout value of 0 guarantees a softfork will never be activated. - // This is used when softfork codes are merged without specifying the - // deployment schedule. - if (consensusParams.vDeployments[id].nTimeout > 0) { - bip9_softforks.push_back( - Pair(name, BIP9SoftForkDesc(consensusParams, id))); - } -} - UniValue getblockchaininfo(const Config &config, const JSONRPCRequest &request) { if (request.fHelp || request.params.size() != 0) { @@ -1324,8 +1278,6 @@ softforks.push_back(SoftForkDesc("bip66", 3, tip, consensusParams)); softforks.push_back(SoftForkDesc("bip65", 4, tip, consensusParams)); softforks.push_back(SoftForkDesc("csv", 5, tip, consensusParams)); - BIP9SoftForkDescPushBack(bip9_softforks, "csv", consensusParams, - Consensus::DEPLOYMENT_CSV); obj.push_back(Pair("softforks", softforks)); obj.push_back(Pair("bip9_softforks", bip9_softforks)); diff --git a/src/validation.h b/src/validation.h --- a/src/validation.h +++ b/src/validation.h @@ -459,15 +459,6 @@ /** Convert CValidationState to a human-readable message for logging */ std::string FormatStateMessage(const CValidationState &state); -/** Get the BIP9 state for a given deployment at the current tip. */ -ThresholdState VersionBitsTipState(const Consensus::Params ¶ms, - Consensus::DeploymentPos pos); - -/** Get the block height at which the BIP9 deployment switched into the state - * for the block building on the current tip. */ -int VersionBitsTipStateSinceHeight(const Consensus::Params ¶ms, - Consensus::DeploymentPos pos); - /** * Count ECDSA signature operations the old-fashioned (pre-0.6) way * @return number of sigops this transaction's outputs will produce when spent diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -5396,19 +5396,6 @@ return &vinfoBlockFile.at(n); } -ThresholdState VersionBitsTipState(const Consensus::Params ¶ms, - Consensus::DeploymentPos pos) { - LOCK(cs_main); - return VersionBitsState(chainActive.Tip(), params, pos, versionbitscache); -} - -int VersionBitsTipStateSinceHeight(const Consensus::Params ¶ms, - Consensus::DeploymentPos pos) { - LOCK(cs_main); - return VersionBitsStateSinceHeight(chainActive.Tip(), params, pos, - versionbitscache); -} - static const uint64_t MEMPOOL_DUMP_VERSION = 1; bool LoadMempool(const Config &config) { diff --git a/src/versionbits.cpp b/src/versionbits.cpp --- a/src/versionbits.cpp +++ b/src/versionbits.cpp @@ -12,10 +12,6 @@ /*.name =*/"testdummy", /*.gbt_force =*/true, }, - { - /*.name =*/"csv", - /*.gbt_force =*/true, - }, }; ThresholdState AbstractThresholdConditionChecker::GetStateFor( diff --git a/test/functional/bip68-112-113-p2p.py b/test/functional/bip68-112-113-p2p.py --- a/test/functional/bip68-112-113-p2p.py +++ b/test/functional/bip68-112-113-p2p.py @@ -13,10 +13,7 @@ activation after a further 144 blocks mine 82 blocks whose coinbases will be used to generate inputs for our tests -mine 61 blocks to transition from DEFINED to STARTED -mine 144 blocks only 100 of which are signaling readiness in order to fail to change state this period -mine 144 blocks with 108 signaling and verify STARTED->LOCKED_IN -mine 140 blocks and seed block chain with the 82 inputs will use for our tests at height 572 +mine 489 blocks and seed block chain with the 82 inputs will use for our tests at height 572 mine 3 blocks and verify still at LOCKED_IN and test that enforcement has not triggered mine 1 block and test that enforcement has triggered (which triggers ACTIVE) Test BIP 113 is enforced @@ -93,6 +90,14 @@ return txs +def get_csv_status(node): + softforks = node.getblockchaininfo()['softforks'] + for sf in softforks: + if sf['id'] == 'csv' and sf['version'] == 5: + return sf['reject']['status'] + raise AssertionError('Cannot find CSV fork activation informations') + + class BIP68_112_113Test(ComparisonTestFramework): def set_test_params(self): self.num_nodes = 1 @@ -126,9 +131,10 @@ tx.deserialize(f) return tx - def generate_blocks(self, number, version, test_blocks=[]): + def generate_blocks(self, number): + test_blocks = [] for i in range(number): - block = self.create_test_block([], version) + block = self.create_test_block([]) test_blocks.append([block, True]) self.last_block_time += 600 self.tip = block.sha256 @@ -227,48 +233,15 @@ self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0) self.nodeaddress = self.nodes[0].getnewaddress() - assert_equal(get_bip9_status(self.nodes[0], 'csv')[ - 'status'], 'defined') - test_blocks = self.generate_blocks(61, 4) + # CSV is not activated yet. + assert_equal(get_csv_status(self.nodes[0]), False) + + # 489 more version 4 blocks + test_blocks = self.generate_blocks(489) yield TestInstance(test_blocks, sync_every_block=False) # 1 - # Advanced from DEFINED to STARTED, height = 143 - assert_equal(get_bip9_status(self.nodes[0], 'csv')[ - 'status'], 'started') - - # Fail to achieve LOCKED_IN 100 out of 144 signal bit 0 - # using a variety of bits to simulate multiple parallel softforks - - # 0x20000001 (signalling ready) - test_blocks = self.generate_blocks(50, 536870913) - # 0x00000004 (signalling not) - test_blocks = self.generate_blocks(20, 4, test_blocks) - # 0x20000101 (signalling ready) - test_blocks = self.generate_blocks(50, 536871169, test_blocks) - # 0x20010000 (signalling not) - test_blocks = self.generate_blocks(24, 536936448, test_blocks) - yield TestInstance(test_blocks, sync_every_block=False) # 2 - # Failed to advance past STARTED, height = 287 - assert_equal(get_bip9_status(self.nodes[0], 'csv')[ - 'status'], 'started') - - # 108 out of 144 signal bit 0 to achieve lock-in - # using a variety of bits to simulate multiple parallel softforks - # 0x20000001 (signalling ready) - test_blocks = self.generate_blocks(58, 536870913) - # 0x00000004 (signalling not) - test_blocks = self.generate_blocks(26, 4, test_blocks) - # 0x20000101 (signalling ready) - test_blocks = self.generate_blocks(50, 536871169, test_blocks) - # 0x20010000 (signalling not) - test_blocks = self.generate_blocks(10, 536936448, test_blocks) - yield TestInstance(test_blocks, sync_every_block=False) # 3 - # Advanced from STARTED to LOCKED_IN, height = 431 - assert_equal(get_bip9_status(self.nodes[0], 'csv')[ - 'status'], 'locked_in') - - # 140 more version 4 blocks - test_blocks = self.generate_blocks(140, 4) - yield TestInstance(test_blocks, sync_every_block=False) # 4 + + # Still not activated. + assert_equal(get_csv_status(self.nodes[0]), False) # Inputs at height = 572 # Put inputs for all tests in the chain at height 572 (tip now = 571) (time increases by 600s per block) @@ -312,11 +285,10 @@ inputblockhash, True)["tx"]), 82 + 1) # 2 more version 4 blocks - test_blocks = self.generate_blocks(2, 4) + test_blocks = self.generate_blocks(2) yield TestInstance(test_blocks, sync_every_block=False) # 5 - # Not yet advanced to ACTIVE, height = 574 (will activate for block 576, not 575) - assert_equal(get_bip9_status(self.nodes[0], 'csv')[ - 'status'], 'locked_in') + # Not yet activated, height = 574 (will activate for block 576, not 575) + assert_equal(get_csv_status(self.nodes[0]), False) # Test both version 1 and version 2 transactions for all tests # BIP113 test transaction will be modified before each use to @@ -404,9 +376,13 @@ # 1 more version 4 block to get us to height 575 so the fork should # now be active for the next block - test_blocks = self.generate_blocks(1, 4) + test_blocks = self.generate_blocks(1) yield TestInstance(test_blocks, sync_every_block=False) # 8 - assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], 'active') + assert_equal(get_csv_status(self.nodes[0]), False) + + self.nodes[0].generate(1) + assert_equal(get_csv_status(self.nodes[0]), True) + self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash()) ################################# ### After Soft Forks Activate ### @@ -437,7 +413,7 @@ self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash()) # Next block height = 580 after 4 blocks of random version - test_blocks = self.generate_blocks(4, 1234) + test_blocks = self.generate_blocks(4) yield TestInstance(test_blocks, sync_every_block=False) # 13 ### BIP 68 ### @@ -476,7 +452,7 @@ yield TestInstance([[self.create_test_block([tx]), False]]) # Advance one block to 581 - test_blocks = self.generate_blocks(1, 1234) + test_blocks = self.generate_blocks(1) yield TestInstance(test_blocks, sync_every_block=False) # 24 # Height txs should fail and time txs should now pass 9 * 600 > 10 * 512 @@ -489,7 +465,7 @@ yield TestInstance([[self.create_test_block([tx]), False]]) # Advance one block to 582 - test_blocks = self.generate_blocks(1, 1234) + test_blocks = self.generate_blocks(1) yield TestInstance(test_blocks, sync_every_block=False) # 30 # All BIP 68 txs should pass diff --git a/test/functional/bip68-sequence.py b/test/functional/bip68-sequence.py --- a/test/functional/bip68-sequence.py +++ b/test/functional/bip68-sequence.py @@ -362,12 +362,19 @@ self.nodes[0].getblockhash(cur_height + 1)) self.nodes[0].generate(10) + def get_csv_status(self): + softforks = self.nodes[0].getblockchaininfo()['softforks'] + for sf in softforks: + if sf['id'] == 'csv' and sf['version'] == 5: + return sf['reject']['status'] + raise AssertionError('Cannot find CSV fork activation informations') + # Make sure that BIP68 isn't being used to validate blocks, prior to # versionbits activation. If more blocks are mined prior to this test # being run, then it's possible the test has activated the soft fork, and # this test should be moved to run earlier, or deleted. def test_bip68_not_consensus(self): - assert(get_bip9_status(self.nodes[0], 'csv')['status'] != 'active') + assert_equal(self.get_csv_status(), False) txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 2) tx1 = FromHex(CTransaction(), self.nodes[0].getrawtransaction(txid)) @@ -414,16 +421,17 @@ assert_equal(self.nodes[0].getbestblockhash(), block.hash) def activateCSV(self): - # activation should happen at block height 432 (3 periods) - # getblockchaininfo will show CSV as active at block 431 (144 * 3 -1) since it's returning whether CSV is active for the next block. - min_activation_height = 432 + # activation should happen at block height 576 + csv_activation_height = 576 height = self.nodes[0].getblockcount() - assert_greater_than(min_activation_height - height, 2) - self.nodes[0].generate(min_activation_height - height - 2) - assert_equal(get_bip9_status(self.nodes[0], 'csv')[ - 'status'], "locked_in") + assert_greater_than(csv_activation_height - height, 1) + self.nodes[0].generate(csv_activation_height - height - 1) + assert_equal(self.get_csv_status(), False) self.nodes[0].generate(1) - assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], "active") + assert_equal(self.get_csv_status(), True) + # We have a block that has CSV activated, but we want to be at + # the activation point, so we invalidate the tip. + self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash()) sync_blocks(self.nodes) # Use self.nodes[1] to test standardness relay policy diff --git a/test/functional/bip9-softforks.py b/test/functional/bip9-softforks.py deleted file mode 100755 --- a/test/functional/bip9-softforks.py +++ /dev/null @@ -1,257 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2015-2016 The Bitcoin Core developers -# Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. - -''' -This test is meant to exercise BIP forks -Connect to a single node. -regtest lock-in with 108/144 block signalling -activation after a further 144 blocks -mine 2 block and save coinbases for later use -mine 141 blocks to transition from DEFINED to STARTED -mine 100 blocks signalling readiness and 44 not in order to fail to change state this period -mine 108 blocks signalling readiness and 36 blocks not signalling readiness (STARTED->LOCKED_IN) -mine a further 143 blocks (LOCKED_IN) -test that enforcement has not triggered (which triggers ACTIVE) -test that enforcement has triggered -''' - -from test_framework.test_framework import ComparisonTestFramework -from test_framework.util import * -from test_framework.mininode import CTransaction, NetworkThread -from test_framework.blocktools import create_coinbase, create_block -from test_framework.comptool import TestInstance, TestManager -from test_framework.script import CScript, OP_1NEGATE, OP_CHECKSEQUENCEVERIFY, OP_DROP -from io import BytesIO -import time -import shutil -import itertools - - -class BIP9SoftForksTest(ComparisonTestFramework): - def set_test_params(self): - self.num_nodes = 1 - self.extra_args = [['-whitelist=127.0.0.1']] - self.setup_clean_chain = True - - def run_test(self): - self.test = TestManager(self, self.options.tmpdir) - self.test.add_all_connections(self.nodes) - NetworkThread().start() # Start up network handling in another thread - self.test.run() - - def create_transaction(self, node, coinbase, to_address, amount): - from_txid = node.getblock(coinbase)['tx'][0] - inputs = [{"txid": from_txid, "vout": 0}] - outputs = {to_address: amount} - rawtx = node.createrawtransaction(inputs, outputs) - tx = CTransaction() - f = BytesIO(hex_str_to_bytes(rawtx)) - tx.deserialize(f) - tx.nVersion = 2 - return tx - - def sign_transaction(self, node, tx): - signresult = node.signrawtransaction(bytes_to_hex_str(tx.serialize())) - tx = CTransaction() - f = BytesIO(hex_str_to_bytes(signresult['hex'])) - tx.deserialize(f) - return tx - - def generate_blocks(self, number, version, test_blocks=[]): - for i in range(number): - block = create_block( - self.tip, create_coinbase(self.height), self.last_block_time + 1) - block.nVersion = version - block.rehash() - block.solve() - test_blocks.append([block, True]) - self.last_block_time += 1 - self.tip = block.sha256 - self.height += 1 - return test_blocks - - def get_bip9_status(self, key): - info = self.nodes[0].getblockchaininfo() - return info['bip9_softforks'][key] - - def test_BIP(self, bipName, activated_version, invalidate, invalidatePostSignature, bitno): - assert_equal(self.get_bip9_status(bipName)['status'], 'defined') - assert_equal(self.get_bip9_status(bipName)['since'], 0) - - # generate some coins for later - self.coinbase_blocks = self.nodes[0].generate(2) - self.height = 3 # height of the next block to build - self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0) - self.nodeaddress = self.nodes[0].getnewaddress() - self.last_block_time = int(time.time()) - - assert_equal(self.get_bip9_status(bipName)['status'], 'defined') - assert_equal(self.get_bip9_status(bipName)['since'], 0) - tmpl = self.nodes[0].getblocktemplate({}) - assert(bipName not in tmpl['rules']) - assert(bipName not in tmpl['vbavailable']) - assert_equal(tmpl['vbrequired'], 0) - assert_equal(tmpl['version'], 0x20000000) - - # Test 1 - # Advance from DEFINED to STARTED - test_blocks = self.generate_blocks(141, 4) - yield TestInstance(test_blocks, sync_every_block=False) - - assert_equal(self.get_bip9_status(bipName)['status'], 'started') - assert_equal(self.get_bip9_status(bipName)['since'], 144) - tmpl = self.nodes[0].getblocktemplate({}) - assert(bipName not in tmpl['rules']) - assert_equal(tmpl['vbavailable'][bipName], bitno) - assert_equal(tmpl['vbrequired'], 0) - assert(tmpl['version'] & activated_version) - - # Test 2 - # Fail to achieve LOCKED_IN 100 out of 144 signal bit 1 - # using a variety of bits to simulate multiple parallel softforks - test_blocks = self.generate_blocks( - 50, activated_version) # 0x20000001 (signalling ready) - test_blocks = self.generate_blocks( - 20, 4, test_blocks) # 0x00000004 (signalling not) - test_blocks = self.generate_blocks( - 50, activated_version, test_blocks) # 0x20000101 (signalling ready) - test_blocks = self.generate_blocks( - 24, 4, test_blocks) # 0x20010000 (signalling not) - yield TestInstance(test_blocks, sync_every_block=False) - - assert_equal(self.get_bip9_status(bipName)['status'], 'started') - assert_equal(self.get_bip9_status(bipName)['since'], 144) - tmpl = self.nodes[0].getblocktemplate({}) - assert(bipName not in tmpl['rules']) - assert_equal(tmpl['vbavailable'][bipName], bitno) - assert_equal(tmpl['vbrequired'], 0) - assert(tmpl['version'] & activated_version) - - # Test 3 - # 108 out of 144 signal bit 1 to achieve LOCKED_IN - # using a variety of bits to simulate multiple parallel softforks - # 0x20000001 (signalling ready) - test_blocks = self.generate_blocks(58, activated_version) - # 0x00000004 (signalling not) - test_blocks = self.generate_blocks(26, 4, test_blocks) - # 0x20000101 (signalling ready) - test_blocks = self.generate_blocks(50, activated_version, test_blocks) - # 0x20010000 (signalling not) - test_blocks = self.generate_blocks(10, 4, test_blocks) - yield TestInstance(test_blocks, sync_every_block=False) - - assert_equal(self.get_bip9_status(bipName)['status'], 'locked_in') - assert_equal(self.get_bip9_status(bipName)['since'], 432) - tmpl = self.nodes[0].getblocktemplate({}) - assert(bipName not in tmpl['rules']) - - # Test 4 - # 143 more version 536870913 blocks (waiting period-1) - test_blocks = self.generate_blocks(143, 4) - yield TestInstance(test_blocks, sync_every_block=False) - - assert_equal(self.get_bip9_status(bipName)['status'], 'locked_in') - assert_equal(self.get_bip9_status(bipName)['since'], 432) - tmpl = self.nodes[0].getblocktemplate({}) - assert(bipName not in tmpl['rules']) - - # Test 5 - # Check that the new rule is enforced - spendtx = self.create_transaction(self.nodes[0], - self.coinbase_blocks[0], self.nodeaddress, 1.0) - invalidate(spendtx) - spendtx = self.sign_transaction(self.nodes[0], spendtx) - spendtx.rehash() - invalidatePostSignature(spendtx) - spendtx.rehash() - block = create_block( - self.tip, create_coinbase(self.height), self.last_block_time + 1) - block.nVersion = activated_version - block.vtx.append(spendtx) - block.hashMerkleRoot = block.calc_merkle_root() - block.rehash() - block.solve() - - self.last_block_time += 1 - self.tip = block.sha256 - self.height += 1 - yield TestInstance([[block, True]]) - - assert_equal(self.get_bip9_status(bipName)['status'], 'active') - assert_equal(self.get_bip9_status(bipName)['since'], 576) - tmpl = self.nodes[0].getblocktemplate({}) - assert(bipName in tmpl['rules']) - assert(bipName not in tmpl['vbavailable']) - assert_equal(tmpl['vbrequired'], 0) - assert(not (tmpl['version'] & (1 << bitno))) - - # Test 6 - # Check that the new sequence lock rules are enforced - spendtx = self.create_transaction(self.nodes[0], - self.coinbase_blocks[1], self.nodeaddress, 1.0) - invalidate(spendtx) - spendtx = self.sign_transaction(self.nodes[0], spendtx) - spendtx.rehash() - invalidatePostSignature(spendtx) - spendtx.rehash() - - block = create_block( - self.tip, create_coinbase(self.height), self.last_block_time + 1) - block.nVersion = 5 - block.vtx.append(spendtx) - block.hashMerkleRoot = block.calc_merkle_root() - block.rehash() - block.solve() - self.last_block_time += 1 - yield TestInstance([[block, False]]) - - # Restart all - self.test.clear_all_connections() - self.stop_nodes() - self.nodes = [] - shutil.rmtree(self.options.tmpdir + "/node0") - self.setup_chain() - self.setup_network() - self.test.add_all_connections(self.nodes) - NetworkThread().start() - self.test.test_nodes[0].wait_for_verack() - - def get_tests(self): - for test in itertools.chain( - self.test_BIP( - 'csv', 0x20000001, self.sequence_lock_invalidate, self.donothing, 0), - self.test_BIP( - 'csv', 0x20000001, self.mtp_invalidate, self.donothing, 0), - self.test_BIP( - 'csv', 0x20000001, self.donothing, self.csv_invalidate, 0) - ): - yield test - - def donothing(self, tx): - return - - def csv_invalidate(self, tx): - '''Modify the signature in vin 0 of the tx to fail CSV - Prepends -1 CSV DROP in the scriptSig itself. - ''' - tx.vin[0].scriptSig = CScript([OP_1NEGATE, OP_CHECKSEQUENCEVERIFY, OP_DROP] + - list(CScript(tx.vin[0].scriptSig))) - - def sequence_lock_invalidate(self, tx): - '''Modify the nSequence to make it fails once sequence lock rule is activated (high timespan) - ''' - tx.vin[0].nSequence = 0x00FFFFFF - tx.nLockTime = 0 - - def mtp_invalidate(self, tx): - '''Modify the nLockTime to make it fails once MTP rule is activated - ''' - # Disable Sequence lock, Activate nLockTime - tx.vin[0].nSequence = 0x90FFFFFF - tx.nLockTime = self.last_block_time - - -if __name__ == '__main__': - BIP9SoftForksTest().main() diff --git a/test/functional/timing.json b/test/functional/timing.json --- a/test/functional/timing.json +++ b/test/functional/timing.json @@ -51,10 +51,6 @@ "name": "bip68-sequence.py", "time": 36 }, - { - "name": "bip9-softforks.py", - "time": 40 - }, { "name": "bipdersig-p2p.py", "time": 6 @@ -339,4 +335,4 @@ "name": "zmq_test.py", "time": 5 } -] \ No newline at end of file +]