Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/test_framework.py
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | def import_deterministic_coinbase_privkeys(self): | ||||
for n in self.nodes: | for n in self.nodes: | ||||
try: | try: | ||||
n.getwalletinfo() | n.getwalletinfo() | ||||
except JSONRPCException as e: | except JSONRPCException as e: | ||||
assert str(e).startswith('Method not found') | assert str(e).startswith('Method not found') | ||||
continue | continue | ||||
n.importprivkey(n.get_deterministic_priv_key()[1]) | n.importprivkey(n.get_deterministic_priv_key().key) | ||||
def run_test(self): | def run_test(self): | ||||
"""Tests must override this method to define test logic""" | """Tests must override this method to define test logic""" | ||||
raise NotImplementedError | raise NotImplementedError | ||||
# Public helper methods. These can be accessed by the subclass test | # Public helper methods. These can be accessed by the subclass test | ||||
# scripts. | # scripts. | ||||
▲ Show 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | def _initialize_chain(self): | ||||
# blocks are created with timestamps 10 minutes apart | # blocks are created with timestamps 10 minutes apart | ||||
# starting from 2010 minutes in the past | # starting from 2010 minutes in the past | ||||
block_time = self.mocktime - (201 * 10 * 60) | block_time = self.mocktime - (201 * 10 * 60) | ||||
for i in range(2): | for i in range(2): | ||||
for peer in range(4): | for peer in range(4): | ||||
for j in range(25): | for j in range(25): | ||||
set_node_times(self.nodes, block_time) | set_node_times(self.nodes, block_time) | ||||
self.nodes[peer].generatetoaddress( | self.nodes[peer].generatetoaddress( | ||||
1, self.nodes[peer].get_deterministic_priv_key()[0]) | 1, self.nodes[peer].get_deterministic_priv_key().address) | ||||
block_time += 10 * 60 | block_time += 10 * 60 | ||||
# Must sync before next peer starts generating blocks | # Must sync before next peer starts generating blocks | ||||
sync_blocks(self.nodes) | sync_blocks(self.nodes) | ||||
# Shut them down, and clean up cache directories: | # Shut them down, and clean up cache directories: | ||||
self.stop_nodes() | self.stop_nodes() | ||||
self.nodes = [] | self.nodes = [] | ||||
self.mocktime = 0 | self.mocktime = 0 | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |