Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_dump.py
Show All 28 Lines | with open(file_name, encoding='utf8') as inputfile: | ||||
# key = key_label.split(" ")[0] | # key = key_label.split(" ")[0] | ||||
keytype = key_label.split(" ")[2] | keytype = key_label.split(" ")[2] | ||||
if len(comment) > 1: | if len(comment) > 1: | ||||
addr_keypath = comment.split(" addr=")[1] | addr_keypath = comment.split(" addr=")[1] | ||||
addr = addr_keypath.split(" ")[0] | addr = addr_keypath.split(" ")[0] | ||||
keypath = None | keypath = None | ||||
if keytype == "inactivehdseed=1": | if keytype == "inactivehdseed=1": | ||||
# ensure the old master is still available | # ensure the old master is still available | ||||
assert(hd_master_addr_old == addr) | assert hd_master_addr_old == addr | ||||
elif keytype == "hdseed=1": | elif keytype == "hdseed=1": | ||||
# ensure we have generated a new hd master key | # ensure we have generated a new hd master key | ||||
assert(hd_master_addr_old != addr) | assert hd_master_addr_old != addr | ||||
hd_master_addr_ret = addr | hd_master_addr_ret = addr | ||||
elif keytype == "script=1": | elif keytype == "script=1": | ||||
# scripts don't have keypaths | # scripts don't have keypaths | ||||
keypath = None | keypath = None | ||||
else: | else: | ||||
keypath = addr_keypath.rstrip().split("hdkeypath=")[1] | keypath = addr_keypath.rstrip().split("hdkeypath=")[1] | ||||
# count key types | # count key types | ||||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.nodes[0].dumpwallet, tmpdir + "/node0/wallet.unencrypted.dump") | self.nodes[0].dumpwallet, tmpdir + "/node0/wallet.unencrypted.dump") | ||||
# Restart node with new wallet, and test importwallet | # Restart node with new wallet, and test importwallet | ||||
self.stop_node(0) | self.stop_node(0) | ||||
self.start_node(0, ['-wallet=w2']) | self.start_node(0, ['-wallet=w2']) | ||||
# Make sure the address is not IsMine before import | # Make sure the address is not IsMine before import | ||||
result = self.nodes[0].getaddressinfo(multisig_addr) | result = self.nodes[0].getaddressinfo(multisig_addr) | ||||
assert(result['ismine'] == False) | assert result['ismine'] == False | ||||
self.nodes[0].importwallet(os.path.abspath( | self.nodes[0].importwallet(os.path.abspath( | ||||
tmpdir + "/node0/wallet.unencrypted.dump")) | tmpdir + "/node0/wallet.unencrypted.dump")) | ||||
# Now check IsMine is true | # Now check IsMine is true | ||||
result = self.nodes[0].getaddressinfo(multisig_addr) | result = self.nodes[0].getaddressinfo(multisig_addr) | ||||
assert(result['ismine'] == True) | assert result['ismine'] == True | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
WalletDumpTest().main() | WalletDumpTest().main() |