Changeset View
Changeset View
Standalone View
Standalone View
test/functional/walletbackup.py
Show All 34 Lines | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from random import randint | from random import randint | ||||
import shutil | import shutil | ||||
class WalletBackupTest(BitcoinTestFramework): | class WalletBackupTest(BitcoinTestFramework): | ||||
def set_test_params(self): | |||||
def __init__(self): | |||||
super().__init__() | |||||
self.setup_clean_chain = True | |||||
self.num_nodes = 4 | self.num_nodes = 4 | ||||
self.setup_clean_chain = True | |||||
# nodes 1, 2,3 are spenders, let's give them a keypool=100 | # nodes 1, 2,3 are spenders, let's give them a keypool=100 | ||||
self.extra_args = [ | self.extra_args = [ | ||||
["-keypool=100"], ["-keypool=100"], ["-keypool=100"], []] | ["-keypool=100"], ["-keypool=100"], ["-keypool=100"], []] | ||||
# This mirrors how the network was setup in the bash test | # This mirrors how the network was setup in the bash test | ||||
def setup_network(self): | def setup_network(self): | ||||
self.setup_nodes() | self.setup_nodes() | ||||
connect_nodes(self.nodes[0], 3) | connect_nodes(self.nodes[0], 3) | ||||
Show All 22 Lines | def do_one_round(self): | ||||
# Have the miner (node3) mine a block. | # Have the miner (node3) mine a block. | ||||
# Must sync mempools before mining. | # Must sync mempools before mining. | ||||
sync_mempools(self.nodes) | sync_mempools(self.nodes) | ||||
self.nodes[3].generate(1) | self.nodes[3].generate(1) | ||||
sync_blocks(self.nodes) | sync_blocks(self.nodes) | ||||
# As above, this mirrors the original bash test. | # As above, this mirrors the original bash test. | ||||
def start_three(self): | def start_three(self): | ||||
self.nodes[0] = self.start_node(0, self.options.tmpdir) | self.start_node(0) | ||||
self.nodes[1] = self.start_node(1, self.options.tmpdir) | self.start_node(1) | ||||
self.nodes[2] = self.start_node(2, self.options.tmpdir) | self.start_node(2) | ||||
connect_nodes(self.nodes[0], 3) | connect_nodes(self.nodes[0], 3) | ||||
connect_nodes(self.nodes[1], 3) | connect_nodes(self.nodes[1], 3) | ||||
connect_nodes(self.nodes[2], 3) | connect_nodes(self.nodes[2], 3) | ||||
connect_nodes(self.nodes[2], 0) | connect_nodes(self.nodes[2], 0) | ||||
def stop_three(self): | def stop_three(self): | ||||
self.stop_node(0) | self.stop_node(0) | ||||
self.stop_node(1) | self.stop_node(1) | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |