Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/bip68-112-113-p2p.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. | ||||
from test_framework.test_framework import ComparisonTestFramework | from test_framework.test_framework import ComparisonTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.mininode import ToHex, CTransaction, NetworkThread | from test_framework.mininode import ToHex, CTransaction, NetworkThread | ||||
from test_framework.blocktools import create_coinbase, create_block | from test_framework.blocktools import create_coinbase, create_block | ||||
from test_framework.comptool import TestInstance, TestManager | from test_framework.comptool import TestInstance, TestManager | ||||
from test_framework.script import * | from test_framework.script import * | ||||
from io import BytesIO | from io import BytesIO | ||||
import time | import time | ||||
# far in the future | |||||
UAHF_START_TIME = 2000000000 | |||||
''' | ''' | ||||
This test is meant to exercise activation of the first version bits soft fork | This test is meant to exercise activation of the first version bits soft fork | ||||
This soft fork will activate the following BIPS: | This soft fork will activate the following BIPS: | ||||
BIP 68 - nSequence relative lock times | BIP 68 - nSequence relative lock times | ||||
BIP 112 - CHECKSEQUENCEVERIFY | BIP 112 - CHECKSEQUENCEVERIFY | ||||
BIP 113 - MedianTimePast semantics for nLockTime | BIP 113 - MedianTimePast semantics for nLockTime | ||||
regtest lock-in with 108/144 block signalling | regtest lock-in with 108/144 block signalling | ||||
▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | class BIP68_112_113Test(ComparisonTestFramework): | ||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
def setup_network(self): | def setup_network(self): | ||||
# Must set the blockversion for this test | # Must set the blockversion for this test | ||||
self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, | self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, | ||||
extra_args=[ | extra_args=[['-debug', | ||||
['-debug', '-whitelist=127.0.0.1', '-blockversion=4']], | '-whitelist=127.0.0.1', | ||||
'-blockversion=4', | |||||
"-uahfstarttime=%d" % UAHF_START_TIME]], | |||||
binary=[self.options.testbinary]) | binary=[self.options.testbinary]) | ||||
def run_test(self): | def run_test(self): | ||||
test = TestManager(self, self.options.tmpdir) | test = TestManager(self, self.options.tmpdir) | ||||
test.add_all_connections(self.nodes) | test.add_all_connections(self.nodes) | ||||
NetworkThread().start() # Start up network handling in another thread | NetworkThread().start() # Start up network handling in another thread | ||||
test.run() | test.run() | ||||
▲ Show 20 Lines • Show All 504 Lines • Show Last 20 Lines |