Changeset View
Changeset View
Standalone View
Standalone View
test/functional/bip68-112-113-p2p.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | |||||
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 | |||||
MAGNETIC_ANOMALY_START_TIME = 2000000000 | |||||
base_relative_locktime = 10 | base_relative_locktime = 10 | ||||
seq_disable_flag = 1 << 31 | seq_disable_flag = 1 << 31 | ||||
seq_random_high_bit = 1 << 25 | seq_random_high_bit = 1 << 25 | ||||
seq_type_flag = 1 << 22 | seq_type_flag = 1 << 22 | ||||
seq_random_low_bit = 1 << 18 | seq_random_low_bit = 1 << 18 | ||||
# b31,b25,b22,b18 represent the 31st, 25th, 22nd and 18th bits respectively in the nSequence field | # b31,b25,b22,b18 represent the 31st, 25th, 22nd and 18th bits respectively in the nSequence field | ||||
# relative_locktimes[b31][b25][b22][b18] is a base_relative_locktime with the indicated bits set if their indices are 1 | # relative_locktimes[b31][b25][b22][b18] is a base_relative_locktime with the indicated bits set if their indices are 1 | ||||
Show All 37 Lines | for sf in softforks: | ||||
return sf['reject']['status'] | return sf['reject']['status'] | ||||
raise AssertionError('Cannot find CSV fork activation informations') | raise AssertionError('Cannot find CSV fork activation informations') | ||||
class BIP68_112_113Test(ComparisonTestFramework): | class BIP68_112_113Test(ComparisonTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4']] | self.extra_args = [['-whitelist=127.0.0.1', '-blockversion=4', | ||||
'-magneticanomalyactivationtime=%d' % MAGNETIC_ANOMALY_START_TIME]] | |||||
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() | ||||
def send_generic_input_tx(self, node, coinbases): | def send_generic_input_tx(self, node, coinbases): | ||||
▲ Show 20 Lines • Show All 488 Lines • Show Last 20 Lines |