Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_hd.py
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.log.info("Restore backup ...") | self.log.info("Restore backup ...") | ||||
self.stop_node(1) | self.stop_node(1) | ||||
# we need to delete the complete regtest directory | # we need to delete the complete regtest directory | ||||
# otherwise node1 would auto-recover all funds in flag the keypool keys as used | # otherwise node1 would auto-recover all funds in flag the keypool keys as used | ||||
shutil.rmtree(os.path.join(tmpdir, "node1/regtest/blocks")) | shutil.rmtree(os.path.join(tmpdir, "node1/regtest/blocks")) | ||||
shutil.rmtree(os.path.join(tmpdir, "node1/regtest/chainstate")) | shutil.rmtree(os.path.join(tmpdir, "node1/regtest/chainstate")) | ||||
shutil.copyfile(os.path.join(tmpdir, "hd.bak"), | shutil.copyfile(os.path.join(tmpdir, "hd.bak"), | ||||
os.path.join(tmpdir, "node1/regtest/wallet.dat")) | os.path.join(tmpdir, "node1/regtest/wallets/wallet.dat")) | ||||
self.start_node(1) | self.start_node(1) | ||||
# Assert that derivation is deterministic | # Assert that derivation is deterministic | ||||
hd_add_2 = None | hd_add_2 = None | ||||
for _ in range(num_hd_adds): | for _ in range(num_hd_adds): | ||||
hd_add_2 = self.nodes[1].getnewaddress() | hd_add_2 = self.nodes[1].getnewaddress() | ||||
hd_info_2 = self.nodes[1].validateaddress(hd_add_2) | hd_info_2 = self.nodes[1].validateaddress(hd_add_2) | ||||
assert_equal(hd_info_2["hdkeypath"], "m/0'/0'/" + str(_) + "'") | assert_equal(hd_info_2["hdkeypath"], "m/0'/0'/" + str(_) + "'") | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |