Browse Source

Merge #11743: qa: Add multiwallet prefix test

fa61c6f6a qa: Add multiwallet prefix test (MarcoFalke)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/pull/10849#discussion_r127847938

Tree-SHA512: 7967be04e76d935398b3bea60c864ffc9e38dbb4cfb55890bb146a6f16c28d81ca5d89736275e2d0b03642806f6f7093beeea979f5257c464f437c4e5a9684f1
0.16
MarcoFalke 7 years ago
parent
commit
3d6ad40777
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25
  1. 11
      test/functional/multiwallet.py

11
test/functional/multiwallet.py

@ -16,10 +16,10 @@ class MultiWalletTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 1 self.num_nodes = 1
self.extra_args = [['-wallet=w1', '-wallet=w2', '-wallet=w3']] self.extra_args = [['-wallet=w1', '-wallet=w2', '-wallet=w3', '-wallet=w']]
def run_test(self): def run_test(self):
assert_equal(set(self.nodes[0].listwallets()), {"w1", "w2", "w3"}) assert_equal(set(self.nodes[0].listwallets()), {"w1", "w2", "w3", "w"})
self.stop_node(0) self.stop_node(0)
@ -66,6 +66,7 @@ class MultiWalletTest(BitcoinTestFramework):
w1 = self.nodes[0].get_wallet_rpc("w1") w1 = self.nodes[0].get_wallet_rpc("w1")
w2 = self.nodes[0].get_wallet_rpc("w2") w2 = self.nodes[0].get_wallet_rpc("w2")
w3 = self.nodes[0].get_wallet_rpc("w3") w3 = self.nodes[0].get_wallet_rpc("w3")
w4 = self.nodes[0].get_wallet_rpc("w")
wallet_bad = self.nodes[0].get_wallet_rpc("bad") wallet_bad = self.nodes[0].get_wallet_rpc("bad")
w1.generate(1) w1.generate(1)
@ -91,18 +92,22 @@ class MultiWalletTest(BitcoinTestFramework):
w3_name = w3.getwalletinfo()['walletname'] w3_name = w3.getwalletinfo()['walletname']
assert_equal(w3_name, "w3") assert_equal(w3_name, "w3")
assert_equal({"w1", "w2", "w3"}, {w1_name, w2_name, w3_name}) w4_name = w4.getwalletinfo()['walletname']
assert_equal(w4_name, "w")
w1.generate(101) w1.generate(101)
assert_equal(w1.getbalance(), 100) assert_equal(w1.getbalance(), 100)
assert_equal(w2.getbalance(), 0) assert_equal(w2.getbalance(), 0)
assert_equal(w3.getbalance(), 0) assert_equal(w3.getbalance(), 0)
assert_equal(w4.getbalance(), 0)
w1.sendtoaddress(w2.getnewaddress(), 1) w1.sendtoaddress(w2.getnewaddress(), 1)
w1.sendtoaddress(w3.getnewaddress(), 2) w1.sendtoaddress(w3.getnewaddress(), 2)
w1.sendtoaddress(w4.getnewaddress(), 3)
w1.generate(1) w1.generate(1)
assert_equal(w2.getbalance(), 1) assert_equal(w2.getbalance(), 1)
assert_equal(w3.getbalance(), 2) assert_equal(w3.getbalance(), 2)
assert_equal(w4.getbalance(), 3)
batch = w1.batch([w1.getblockchaininfo.get_request(), w1.getwalletinfo.get_request()]) batch = w1.batch([w1.getblockchaininfo.get_request(), w1.getwalletinfo.get_request()])
assert_equal(batch[0]["result"]["chain"], "regtest") assert_equal(batch[0]["result"]["chain"], "regtest")

Loading…
Cancel
Save