Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet-dump.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. | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import (assert_equal, bitcoind_processes) | from test_framework.util import assert_equal | ||||
def read_dump(file_name, addrs, hd_master_addr_old): | def read_dump(file_name, addrs, hd_master_addr_old): | ||||
""" | """ | ||||
Read the given dump, count the addrs that match, count change and reserve. | Read the given dump, count the addrs that match, count change and reserve. | ||||
Also check that the old hd_master is inactive | Also check that the old hd_master is inactive | ||||
""" | """ | ||||
with open(file_name, encoding='utf8') as inputfile: | with open(file_name, encoding='utf8') as inputfile: | ||||
▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
assert_equal(found_addr, test_addr_count) | assert_equal(found_addr, test_addr_count) | ||||
# all keys must be in the dump | # all keys must be in the dump | ||||
assert_equal(found_addr_chg, 50) # 50 blocks where mined | assert_equal(found_addr_chg, 50) # 50 blocks where mined | ||||
# 90 keys plus 100% internal keys | # 90 keys plus 100% internal keys | ||||
assert_equal(found_addr_rsv, 90 * 2) | assert_equal(found_addr_rsv, 90 * 2) | ||||
# encrypt wallet, restart, unlock and dump | # encrypt wallet, restart, unlock and dump | ||||
self.nodes[0].encryptwallet('test') | self.nodes[0].encryptwallet('test') | ||||
bitcoind_processes[0].wait() | self.bitcoind_processes[0].wait() | ||||
self.nodes[0] = self.start_node( | self.nodes[0] = self.start_node( | ||||
0, self.options.tmpdir, self.extra_args[0]) | 0, self.options.tmpdir, self.extra_args[0]) | ||||
self.nodes[0].walletpassphrase('test', 10) | self.nodes[0].walletpassphrase('test', 10) | ||||
# Should be a no-op: | # Should be a no-op: | ||||
self.nodes[0].keypoolrefill() | self.nodes[0].keypoolrefill() | ||||
self.nodes[0].dumpwallet(tmpdir + "/node0/wallet.encrypted.dump") | self.nodes[0].dumpwallet(tmpdir + "/node0/wallet.encrypted.dump") | ||||
found_addr, found_addr_chg, found_addr_rsv, hd_master_addr_enc = \ | found_addr, found_addr_chg, found_addr_rsv, hd_master_addr_enc = \ | ||||
Show All 10 Lines |