Skip to content

Commit

Permalink
Merge bitcoin#505: [0.17] Activate CSV from genesis block for custom …
Browse files Browse the repository at this point in the history
…chains

91dd327 Disable functional tests for bitcoin_functional build (Gregory Sanders)
b8820d1 Activate CSV from genesis block for custom chains (Gregory Sanders)

Pull request description:

  Guts the test for elements mode, can add back later if worked on.

Tree-SHA512: a2b7633fa02dae582616ac26d25cd08f895d5940e3775c70cacdd3f678f01a21cbcaf56c6c540b91bd8535bb1aab7bdc59e2a79b5a1124cbd9d3f03f29d0b40e
  • Loading branch information
stevenroose committed Feb 14, 2019
2 parents fd9bdc6 + 91dd327 commit 658dae0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,6 @@ jobs:
PACKAGES="python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev"
NO_DEPENDS=1
RUN_BITCOIN_TESTS=true
RUN_FUNCTIONAL_TESTS=false
GOAL="install"
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --enable-glibc-back-compat --enable-reduce-exports --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER"
7 changes: 6 additions & 1 deletion src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,12 @@ class CCustomParams : public CRegTestParams {
parent_bech32_hrp = args.GetArg("-parent_bech32_hrp", "bcrt");

// END ELEMENTS fields
//

// CSV always active by default, unlike regtest
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = args.GetArg("-con_csv_deploy_start", Consensus::BIP9Deployment::ALWAYS_ACTIVE);
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;

}

void SetGenesisBlock() {
Expand Down
1 change: 1 addition & 0 deletions src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void SetupChainParamsBaseOptions()
gArgs.AddArg("-enforce_pak", "Causes standardness checks to enforce Pegout Authorization Key(PAK) validation, and miner to include PAK commitments when configured. Can not be set when acceptnonstdtx is set to true.", false, OptionsCategory::ELEMENTS);
gArgs.AddArg("-multi_data_permitted", "Allow relay of multiple OP_RETURN outputs. (default: true)", false, OptionsCategory::ELEMENTS);
gArgs.AddArg("-pak", "Entries in the PAK list. Order of entries matter.", false, OptionsCategory::ELEMENTS);
gArgs.AddArg("-con_csv_deploy_start", "Starting height for CSV deployment. (default: -1, which means ACTIVE from genesis)", false, OptionsCategory::ELEMENTS);
}

static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
Expand Down
1 change: 1 addition & 0 deletions test/bitcoin_functional/functional/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def initialize_datadir(dirname, n, chain):
f.write("con_bip65height=1351\n")
f.write("con_bip66height=1251\n")
f.write("con_genesis_style=bitcoin\n")
f.write("con_csv_deploy_start=0\n") # Default is -1 (always active)
os.makedirs(os.path.join(datadir, 'stderr'), exist_ok=True)
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
return datadir
Expand Down
11 changes: 8 additions & 3 deletions test/functional/feature_block_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test BIP 34, 65, 66 activation at block 0"""
"""Test BIP 34, 65, 66, CSV activation at block 0"""

from test_framework.blocktools import create_coinbase, create_block, create_transaction
from test_framework.messages import msg_block
from test_framework.mininode import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
from test_framework.util import assert_equal, get_bip9_status

from feature_cltv import cltv_validate

class BlockV4Test(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.extra_args = [['-whitelist=127.0.0.1', '-con_bip34height=0', '-con_bip65height=0', '-con_bip66height=0']]
self.extra_args = [['-whitelist=127.0.0.1', '-con_bip34height=0', '-con_bip65height=0', '-con_bip66height=0', '-con_csv_deploy_start=-1']]
self.setup_clean_chain = True

def run_test(self):

# First, quick check that CSV is ACTIVE at genesis
assert_equal(self.nodes[0].getblockcount(), 0)
assert_equal(get_bip9_status(self.nodes[0], 'csv')['status'], 'active')

self.nodes[0].add_p2p_connection(P2PInterface())

self.nodeaddress = self.nodes[0].getnewaddress()
Expand Down
1 change: 1 addition & 0 deletions test/functional/test_framework/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ def initialize_datadir(dirname, n, chain):
f.write("con_bip34height=100000000\n")
f.write("con_bip65height=1351\n")
f.write("con_bip66height=1251\n")
f.write("con_csv_deploy_start=0\n") # Enhance tests if removing this line
os.makedirs(os.path.join(datadir, 'stderr'), exist_ok=True)
os.makedirs(os.path.join(datadir, 'stdout'), exist_ok=True)
return datadir
Expand Down

0 comments on commit 658dae0

Please sign in to comment.