Changeset View
Changeset View
Standalone View
Standalone View
test/functional/multiwallet.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2017 The Bitcoin Core developers | # Copyright (c) 2017 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 multiwallet. | """Test multiwallet. | ||||
Verify that a bitcoind node can load multiple wallet files | Verify that a bitcoind node can load multiple wallet files | ||||
""" | """ | ||||
import os | import os | ||||
import shutil | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal, assert_raises_rpc_error | from test_framework.util import assert_equal, assert_raises_rpc_error | ||||
class MultiWalletTest(BitcoinTestFramework): | class MultiWalletTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
Show All 9 Lines | def run_test(self): | ||||
self.assert_start_raises_init_error( | self.assert_start_raises_init_error( | ||||
0, ['-wallet=w1', '-wallet=w1'], 'Error loading wallet w1. Duplicate -wallet filename specified.') | 0, ['-wallet=w1', '-wallet=w1'], 'Error loading wallet w1. Duplicate -wallet filename specified.') | ||||
# should not initialize if wallet file is a directory | # should not initialize if wallet file is a directory | ||||
os.mkdir(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w11')) | os.mkdir(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w11')) | ||||
self.assert_start_raises_init_error( | self.assert_start_raises_init_error( | ||||
0, ['-wallet=w11'], 'Error loading wallet w11. -wallet filename must be a regular file.') | 0, ['-wallet=w11'], 'Error loading wallet w11. -wallet filename must be a regular file.') | ||||
# should not initialize if one wallet is a copy of another | |||||
shutil.copyfile(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w2'), | |||||
os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w22')) | |||||
self.assert_start_raises_init_error( | |||||
0, ['-wallet=w2', '-wallet=w22'], 'duplicates fileid') | |||||
# should not initialize if wallet file is a symlink | # should not initialize if wallet file is a symlink | ||||
wallet_dir = os.path.abspath(os.path.join( | wallet_dir = os.path.abspath(os.path.join( | ||||
self.options.tmpdir, 'node0', 'regtest')) | self.options.tmpdir, 'node0', 'regtest')) | ||||
os.symlink(os.path.join(wallet_dir, 'w1'), | os.symlink(os.path.join(wallet_dir, 'w1'), | ||||
os.path.join(wallet_dir, 'w12')) | os.path.join(wallet_dir, 'w12')) | ||||
self.assert_start_raises_init_error( | self.assert_start_raises_init_error( | ||||
0, ['-wallet=w12'], 'Error loading wallet w12. -wallet filename must be a regular file.') | 0, ['-wallet=w12'], 'Error loading wallet w12. -wallet filename must be a regular file.') | ||||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |