2
2
# Copyright (c) 2017 The Bitcoin Core developers
3
3
# Distributed under the MIT software license, see the accompanying
4
4
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
- """Test multiwallet."""
5
+ """Test multiwallet.
6
+
7
+ Verify that a bitcoind node can load multiple wallet files
8
+ """
6
9
from test_framework .test_framework import BitcoinTestFramework
7
- from test_framework .util import *
10
+ from test_framework .util import assert_equal , assert_raises_jsonrpc
8
11
9
12
class MultiWalletTest (BitcoinTestFramework ):
10
13
@@ -18,20 +21,28 @@ def run_test(self):
18
21
w1 = self .nodes [0 ] / "wallet/w1"
19
22
w1 .generate (1 )
20
23
21
- #accessing wallet RPC without using wallet endpoint fails
24
+ # accessing wallet RPC without using wallet endpoint fails
22
25
assert_raises_jsonrpc (- 32601 , "Method not found" , self .nodes [0 ].getwalletinfo )
23
26
24
- #check w1 wallet balance
25
- walletinfo = w1 .getwalletinfo ()
26
- assert_equal (walletinfo ['immature_balance' ], 50 )
27
+ # check w1 wallet balance
28
+ w1_info = w1 .getwalletinfo ()
29
+ assert_equal (w1_info ['immature_balance' ], 50 )
30
+ w1_name = w1_info ['walletname' ]
31
+ assert_equal (w1_name , "w1" )
27
32
28
- #check w1 wallet balance
33
+ # check w1 wallet balance
29
34
w2 = self .nodes [0 ] / "wallet/w2"
30
- walletinfo = w2 .getwalletinfo ()
31
- assert_equal (walletinfo ['immature_balance' ], 0 )
35
+ w2_info = w2 .getwalletinfo ()
36
+ assert_equal (w2_info ['immature_balance' ], 0 )
37
+ w2_name = w2_info ['walletname' ]
38
+ assert_equal (w2_name , "w2" )
32
39
33
40
w3 = self .nodes [0 ] / "wallet/w3"
34
-
41
+ w3_name = w3 .getwalletinfo ()['walletname' ]
42
+ assert_equal (w3_name , "w3" )
43
+
44
+ assert_equal ({"w1" , "w2" , "w3" }, {w1_name , w2_name , w3_name })
45
+
35
46
w1 .generate (101 )
36
47
assert_equal (w1 .getbalance (), 100 )
37
48
assert_equal (w2 .getbalance (), 0 )
0 commit comments