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. | ||||
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, | ||||
assert_start_raises_init_error | |||||
) | ) | ||||
import os | import os | ||||
import shutil | import shutil | ||||
class WalletHDTest(BitcoinTestFramework): | class WalletHDTest(BitcoinTestFramework): | ||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 2 | self.num_nodes = 2 | ||||
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']] | self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']] | ||||
def run_test(self): | def run_test(self): | ||||
tmpdir = self.options.tmpdir | tmpdir = self.options.tmpdir | ||||
# Make sure can't switch off usehd after wallet creation | # Make sure can't switch off usehd after wallet creation | ||||
self.stop_node(1) | self.stop_node(1) | ||||
assert_start_raises_init_error(1, self.options.tmpdir, [ | self.assert_start_raises_init_error( | ||||
'-usehd=0'], 'already existing HD wallet') | 1, self.options.tmpdir, ['-usehd=0'], 'already existing HD wallet') | ||||
self.nodes[1] = self.start_node( | self.nodes[1] = self.start_node( | ||||
1, self.options.tmpdir, self.extra_args[1]) | 1, self.options.tmpdir, self.extra_args[1]) | ||||
connect_nodes_bi(self.nodes, 0, 1) | connect_nodes_bi(self.nodes, 0, 1) | ||||
# Make sure we use hd, keep masterkeyid | # Make sure we use hd, keep masterkeyid | ||||
masterkeyid = self.nodes[1].getwalletinfo()['hdmasterkeyid'] | masterkeyid = self.nodes[1].getwalletinfo()['hdmasterkeyid'] | ||||
assert_equal(len(masterkeyid), 40) | assert_equal(len(masterkeyid), 40) | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |