Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_dersig.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2015-2016 The Bitcoin Core developers | # Copyright (c) 2015-2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test BIP66 (DER SIG). | """Test BIP66 (DER SIG). | ||||
Test that the DERSIG soft-fork activates at (regtest) height 1251. | Test that the DERSIG soft-fork activates at (regtest) height 1251. | ||||
""" | """ | ||||
from test_framework.blocktools import create_block, create_coinbase | from test_framework.blocktools import create_block, create_coinbase | ||||
from test_framework.messages import CTransaction, FromHex, msg_block, ToHex | from test_framework.messages import CTransaction, FromHex, msg_block, ToHex | ||||
from test_framework.mininode import ( | from test_framework.mininode import ( | ||||
mininode_lock, | mininode_lock, | ||||
network_thread_start, | |||||
P2PInterface, | P2PInterface, | ||||
) | ) | ||||
from test_framework.script import CScript | from test_framework.script import CScript | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal, wait_until | from test_framework.util import assert_equal, wait_until | ||||
DERSIG_HEIGHT = 1251 | DERSIG_HEIGHT = 1251 | ||||
Show All 34 Lines | class BIP66Test(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.extra_args = [['-whitelist=127.0.0.1', '-enablebip61']] | self.extra_args = [['-whitelist=127.0.0.1', '-enablebip61']] | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
def run_test(self): | def run_test(self): | ||||
self.nodes[0].add_p2p_connection(P2PInterface()) | self.nodes[0].add_p2p_connection(P2PInterface()) | ||||
network_thread_start() | |||||
# wait_for_verack ensures that the P2P connection is fully up. | # wait_for_verack ensures that the P2P connection is fully up. | ||||
self.nodes[0].p2p.wait_for_verack() | self.nodes[0].p2p.wait_for_verack() | ||||
self.log.info("Mining {} blocks".format(DERSIG_HEIGHT - 1)) | self.log.info("Mining {} blocks".format(DERSIG_HEIGHT - 1)) | ||||
self.coinbase_blocks = self.nodes[0].generate(DERSIG_HEIGHT - 1) | self.coinbase_blocks = self.nodes[0].generate(DERSIG_HEIGHT - 1) | ||||
self.nodeaddress = self.nodes[0].getnewaddress() | self.nodeaddress = self.nodes[0].getnewaddress() | ||||
self.log.info("Test that blocks must now be at least version 3") | self.log.info("Test that blocks must now be at least version 3") | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |