Skip to content

Commit e6f053a

Browse files
committed
Add tests of listreceivedbyaddress address filtering
1 parent c60de5d commit e6f053a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

qa/rpc-tests/receivedby.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,24 @@ def run_test(self):
6565
assert_array_result(self.nodes[1].listreceivedbyaddress(11),{"address":addr},{ },True)
6666

6767
#Empty Tx
68-
addr = self.nodes[1].getnewaddress()
68+
empty_addr = self.nodes[1].getnewaddress()
6969
assert_array_result(self.nodes[1].listreceivedbyaddress(0,True),
70-
{"address":addr},
71-
{"address":addr, "account":"", "amount":0, "confirmations":0, "txids":[]})
70+
{"address":empty_addr},
71+
{"address":empty_addr, "account":"", "amount":0, "confirmations":0, "txids":[]})
72+
73+
#Test Address filtering
74+
#Only on addr
75+
expected = {"address":addr, "account":"", "amount":Decimal("0.1"), "confirmations":10, "txids":[txid,]}
76+
res = self.nodes[1].listreceivedbyaddress(0, True, True, addr)
77+
assert_array_result(res, {"address":addr}, expected)
78+
if len(res) != 1:
79+
raise AssertionError("listreceivedbyaddress expected only 1 result")
80+
81+
#Not on addr
82+
other_addr = self.nodes[0].getnewaddress() # note on node[0]! just a random addr
83+
res = self.nodes[1].listreceivedbyaddress(0, True, True, other_addr)
84+
if res != []:
85+
raise AssertionError("Should not have listed any transactions, got\n%s"%res)
7286

7387
'''
7488
getreceivedbyaddress Test

0 commit comments

Comments
 (0)