aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_balance.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-04-09 09:10:08 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-05-02 10:10:23 -0400
commit999931cf8f167c7547f1015cdf05437a460c27f0 (patch)
treec5b16556718785c7c98a6dc3209b1c3dcbabf7aa /test/functional/wallet_balance.py
parentfad13e925e197163a942f3f0d1ba2c95a2b65a56 (diff)
rpc: Add getbalances RPC
Diffstat (limited to 'test/functional/wallet_balance.py')
-rwxr-xr-xtest/functional/wallet_balance.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py
index c02d7422b9..4d1f1ccdc1 100755
--- a/test/functional/wallet_balance.py
+++ b/test/functional/wallet_balance.py
@@ -59,14 +59,24 @@ class WalletTest(BitcoinTestFramework):
assert_equal(len(self.nodes[0].listunspent()), 0)
assert_equal(len(self.nodes[1].listunspent()), 0)
- self.log.info("Mining blocks ...")
+ self.log.info("Check that only node 0 is watching an address")
+ assert 'watchonly' in self.nodes[0].getbalances()
+ assert 'watchonly' not in self.nodes[1].getbalances()
+ self.log.info("Mining blocks ...")
self.nodes[0].generate(1)
self.sync_all()
self.nodes[1].generate(1)
self.nodes[1].generatetoaddress(101, ADDRESS_WATCHONLY)
self.sync_all()
+ assert_equal(self.nodes[0].getbalances()['mine']['trusted'], 50)
+ assert_equal(self.nodes[0].getwalletinfo()['balance'], 50)
+ assert_equal(self.nodes[1].getbalances()['mine']['trusted'], 50)
+
+ assert_equal(self.nodes[0].getbalances()['watchonly']['immature'], 5000)
+ assert 'watchonly' not in self.nodes[1].getbalances()
+
assert_equal(self.nodes[0].getbalance(), 50)
assert_equal(self.nodes[1].getbalance(), 50)
@@ -107,8 +117,11 @@ class WalletTest(BitcoinTestFramework):
assert_equal(self.nodes[1].getbalance(minconf=1), Decimal('0'))
# getunconfirmedbalance
assert_equal(self.nodes[0].getunconfirmedbalance(), Decimal('60')) # output of node 1's spend
+ assert_equal(self.nodes[0].getbalances()['mine']['untrusted_pending'], Decimal('60'))
assert_equal(self.nodes[0].getwalletinfo()["unconfirmed_balance"], Decimal('60'))
+
assert_equal(self.nodes[1].getunconfirmedbalance(), Decimal('0')) # Doesn't include output of node 0's send since it was spent
+ assert_equal(self.nodes[1].getbalances()['mine']['untrusted_pending'], Decimal('0'))
assert_equal(self.nodes[1].getwalletinfo()["unconfirmed_balance"], Decimal('0'))
test_balances(fee_node_1=Decimal('0.01'))