Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_keypool_topup.py
Show All 11 Lines | |||||
- connect node1 to node0. Verify that they sync and node1 receives its funds.""" | - connect node1 to node0. Verify that they sync and node1 receives its funds.""" | ||||
import os | import os | ||||
import shutil | import shutil | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import ( | from test_framework.util import ( | ||||
assert_equal, | assert_equal, | ||||
connect_nodes_bi, | connect_nodes_bi, | ||||
sync_blocks, | |||||
) | ) | ||||
class KeypoolRestoreTest(BitcoinTestFramework): | class KeypoolRestoreTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 2 | self.num_nodes = 2 | ||||
self.extra_args = [[], ['-keypool=100']] | self.extra_args = [[], ['-keypool=100']] | ||||
Show All 19 Lines | def run_test(self): | ||||
for _ in range(20): | for _ in range(20): | ||||
addr_extpool = self.nodes[1].getnewaddress() | addr_extpool = self.nodes[1].getnewaddress() | ||||
self.log.info("Send funds to wallet") | self.log.info("Send funds to wallet") | ||||
self.nodes[0].sendtoaddress(addr_oldpool, 10) | self.nodes[0].sendtoaddress(addr_oldpool, 10) | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
self.nodes[0].sendtoaddress(addr_extpool, 5) | self.nodes[0].sendtoaddress(addr_extpool, 5) | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
sync_blocks(self.nodes) | self.sync_blocks() | ||||
self.log.info("Restart node with wallet backup") | self.log.info("Restart node with wallet backup") | ||||
self.stop_node(1) | self.stop_node(1) | ||||
shutil.copyfile(wallet_backup_path, wallet_path) | shutil.copyfile(wallet_backup_path, wallet_path) | ||||
self.start_node(1, self.extra_args[1]) | self.start_node(1, self.extra_args[1]) | ||||
connect_nodes_bi(self.nodes[0], self.nodes[1]) | connect_nodes_bi(self.nodes[0], self.nodes[1]) | ||||
self.sync_all() | self.sync_all() | ||||
Show All 11 Lines |