Skip to content

Commit 977be17

Browse files
committed
Merge bitcoin#34188: test: Add multiple transactions and error handling tests for getreceivedbyaddress
d45ec3f test: Add getreceivedbyaddress coverage to wallet_listreceivedby (b-l-u-e) Pull request description: This PR adds comprehensive functional test coverage for the `getreceivedbyaddress` RPC method. ACKs for top commit: maflcko: lgtm ACK d45ec3f fjahr: reACK d45ec3f achow101: ACK d45ec3f rkrux: lgtm ACK d45ec3f Tree-SHA512: e7f024297c18b2e11da108d9588bbf96089dce24e2fdee255dbd2f754f21ec63cb3cefa6d92b621b5ab66d18fe29523b87d14ceba38a83afa4c85eb5944a0fb3
2 parents 3478401 + d45ec3f commit 977be17

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/functional/wallet_listreceivedby.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,17 @@ def run_test(self):
124124
# Trying to getreceivedby for an address the wallet doesn't own should return an error
125125
assert_raises_rpc_error(-4, "Address not found in wallet", self.nodes[0].getreceivedbyaddress, addr)
126126

127+
# Test multiple transactions to the same address
128+
addr_with_multiple_txs = self.nodes[1].getnewaddress()
129+
self.nodes[0].sendtoaddress(addr_with_multiple_txs, Decimal("0.1"))
130+
self.nodes[0].sendtoaddress(addr_with_multiple_txs, Decimal("0.2"))
131+
self.generate(self.nodes[0], 1)
132+
balance = self.nodes[1].getreceivedbyaddress(addr_with_multiple_txs)
133+
assert_equal(balance, Decimal("0.3"))
134+
135+
# Test invalid address format error
136+
assert_raises_rpc_error(-5, "Invalid Bitcoin address", self.nodes[1].getreceivedbyaddress, "invalid_address")
137+
127138
self.log.info("listreceivedbylabel + getreceivedbylabel Test")
128139

129140
# set pre-state
@@ -144,7 +155,7 @@ def run_test(self):
144155
{"label": label},
145156
received_by_label_json)
146157

147-
# getreceivedbyaddress should return same balance because of 0 confirmations
158+
# getreceivedbylabel should return same balance because of 0 confirmations
148159
balance = self.nodes[1].getreceivedbylabel(label)
149160
assert_equal(balance, balance_by_label)
150161

0 commit comments

Comments
 (0)