aboutsummaryrefslogtreecommitdiff
path: root/test/functional/multiwallet.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/multiwallet.py')
-rwxr-xr-xtest/functional/multiwallet.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/functional/multiwallet.py b/test/functional/multiwallet.py
index b4e15a3322..7a0fbce477 100755
--- a/test/functional/multiwallet.py
+++ b/test/functional/multiwallet.py
@@ -7,9 +7,10 @@
Verify that a bitcoind node can load multiple wallet files
"""
import os
+import shutil
from test_framework.test_framework import BitcoinTestFramework
-from test_framework.util import assert_equal, assert_raises_jsonrpc
+from test_framework.util import assert_equal, assert_raises_rpc_error
class MultiWalletTest(BitcoinTestFramework):
def set_test_params(self):
@@ -29,6 +30,11 @@ class MultiWalletTest(BitcoinTestFramework):
os.mkdir(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w11'))
self.assert_start_raises_init_error(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
os.symlink(os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w1'), os.path.join(self.options.tmpdir, 'node0', 'regtest', 'w12'))
self.assert_start_raises_init_error(0, ['-wallet=w12'], 'Error loading wallet w12. -wallet filename must be a regular file.')
@@ -43,10 +49,10 @@ class MultiWalletTest(BitcoinTestFramework):
w1.generate(1)
# accessing invalid wallet fails
- assert_raises_jsonrpc(-18, "Requested wallet does not exist or is not loaded", wallet_bad.getwalletinfo)
+ assert_raises_rpc_error(-18, "Requested wallet does not exist or is not loaded", wallet_bad.getwalletinfo)
# accessing wallet RPC without using wallet endpoint fails
- assert_raises_jsonrpc(-19, "Wallet file not specified", self.nodes[0].getwalletinfo)
+ assert_raises_rpc_error(-19, "Wallet file not specified", self.nodes[0].getwalletinfo)
# check w1 wallet balance
w1_info = w1.getwalletinfo()
@@ -76,5 +82,9 @@ class MultiWalletTest(BitcoinTestFramework):
assert_equal(w2.getbalance(), 1)
assert_equal(w3.getbalance(), 2)
+ batch = w1.batch([w1.getblockchaininfo.get_request(), w1.getwalletinfo.get_request()])
+ assert_equal(batch[0]["result"]["chain"], "regtest")
+ assert_equal(batch[1]["result"]["walletname"], "w1")
+
if __name__ == '__main__':
MultiWalletTest().main()