7 """Test Hierarchical Deterministic wallet function.""" 15 print(
"Initializing test directory "+self.options.tmpdir)
19 self.
nodes =
start_nodes(2, self.options.tmpdir, [[
'-usehd=0'], [
'-usehd=1',
'-keypool=0']])
26 tmpdir = self.options.tmpdir
31 start_node(1, self.options.tmpdir, [
'-usehd=0'])
32 raise AssertionError(
"Must not allow to turn off HD on an already existing HD wallet")
33 except Exception
as e:
34 assert(
"dashd exited with status 1 during initialization" in str(e))
37 self.
nodes[1] =
start_node(1, self.options.tmpdir, [
'-usehd=1',
'-keypool=0'])
47 assert_equal(change_addrV[
"hdkeypath"],
"m/44'/1'/0'/1/0")
62 for i
in range(num_hd_adds):
65 assert_equal(hd_info[
"hdkeypath"],
"m/44'/1'/0'/0/"+str(i+1))
75 assert_equal(change_addrV[
"hdkeypath"],
"m/44'/1'/0'/1/1")
80 print(
"Restore backup ...")
82 os.remove(self.options.tmpdir +
"/node1/regtest/wallet.dat")
83 shutil.copyfile(tmpdir +
"/hd.bak", tmpdir +
"/node1/regtest/wallet.dat")
84 self.
nodes[1] =
start_node(1, self.options.tmpdir, [
'-usehd=1',
'-keypool=0'])
89 for _
in range(num_hd_adds):
92 assert_equal(hd_info_2[
"hdkeypath"],
"m/44'/1'/0'/0/"+str(_+1))
98 self.
nodes[1] =
start_node(1, self.options.tmpdir, [
'-usehd=1',
'-keypool=0',
'-rescan'])
107 if out[
'value'] != 1:
112 if __name__ ==
'__main__':
UniValue importprivkey(const UniValue ¶ms, bool fHelp)
UniValue getrawchangeaddress(const UniValue ¶ms, bool fHelp)
UniValue validateaddress(const UniValue ¶ms, bool fHelp)
UniValue dumpprivkey(const UniValue ¶ms, bool fHelp)
UniValue getbalance(const UniValue ¶ms, bool fHelp)
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None)
UniValue backupwallet(const UniValue ¶ms, bool fHelp)
UniValue sendtoaddress(const UniValue ¶ms, bool fHelp)
UniValue getnewaddress(const UniValue ¶ms, bool fHelp)
def initialize_chain_clean(test_dir, num_nodes)
UniValue getwalletinfo(const UniValue ¶ms, bool fHelp)
UniValue decoderawtransaction(const UniValue ¶ms, bool fHelp)
def start_node(i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None)
UniValue generate(const UniValue ¶ms, bool fHelp)
def assert_equal(thing1, thing2)
def connect_nodes_bi(nodes, a, b)
UniValue gettransaction(const UniValue ¶ms, bool fHelp)