Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet-hd.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2016 The Bitcoin Core developers | # Copyright (c) 2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""Test Hierarchical Deterministic wallet function.""" | |||||
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, | ||||
) | ) | ||||
import shutil | import shutil | ||||
Show All 25 Lines | def run_test(self): | ||||
assert_equal(change_addrV["hdkeypath"], "m/0'/1'/0'") | assert_equal(change_addrV["hdkeypath"], "m/0'/1'/0'") | ||||
# Import a non-HD private key in the HD wallet | # Import a non-HD private key in the HD wallet | ||||
non_hd_add = self.nodes[0].getnewaddress() | non_hd_add = self.nodes[0].getnewaddress() | ||||
self.nodes[1].importprivkey(self.nodes[0].dumpprivkey(non_hd_add)) | self.nodes[1].importprivkey(self.nodes[0].dumpprivkey(non_hd_add)) | ||||
# This should be enough to keep the master key and the non-HD key | # This should be enough to keep the master key and the non-HD key | ||||
self.nodes[1].backupwallet(tmpdir + "/hd.bak") | self.nodes[1].backupwallet(tmpdir + "/hd.bak") | ||||
# self.nodes[1].dumpwallet(tmpdir + "/hd.dump") | #self.nodes[1].dumpwallet(tmpdir + "/hd.dump") | ||||
# Derive some HD addresses and remember the last | # Derive some HD addresses and remember the last | ||||
# Also send funds to each add | # Also send funds to each add | ||||
self.nodes[0].generate(101) | self.nodes[0].generate(101) | ||||
hd_add = None | hd_add = None | ||||
num_hd_adds = 300 | num_hd_adds = 300 | ||||
for i in range(num_hd_adds): | for i in range(num_hd_adds): | ||||
hd_add = self.nodes[1].getnewaddress() | hd_add = self.nodes[1].getnewaddress() | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |