Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion test/functional/wallet_listreceivedby.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ def run_test(self):
# Trying to getreceivedby for an address the wallet doesn't own should return an error
assert_raises_rpc_error(-4, "Address not found in wallet", self.nodes[0].getreceivedbyaddress, addr)

# Test multiple transactions to the same address
addr_with_multiple_txs = self.nodes[1].getnewaddress()
self.nodes[0].sendtoaddress(addr_with_multiple_txs, Decimal("0.1"))
self.nodes[0].sendtoaddress(addr_with_multiple_txs, Decimal("0.2"))
self.generatetoaddress(self.nodes[0], 1, addr_with_multiple_txs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this and just call generate with 5 blocks. Otherwise the test fails.

self.generate(self.nodes[0], 1)
balance = self.nodes[1].getreceivedbyaddress(addr_with_multiple_txs, 5, True)

@xyzconstant xyzconstant Mar 4, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

min confirmation set to 5, and only 2 blocks has been mined. This is making the test to break

@talkingmeat talkingmeat Mar 4, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has two issues:

  • first, min_confirmations is set to 5, and only 2 blocks were mined, this will make the total balance 0, failing the test.
  • second, even if the first issue is fixed, the include_immature_coinbase is set to True; this causes the total balance to be 25.3 + fee instead of 0.3 since node[1] is receiving the coinbase amount in addr_with_multiple_txs from node[0]'s mining.

Make sure tests in CI are all passing!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has two issues:

  • first, min_confirmations is set to 5, and only 2 blocks were mined, this will make the total balance 0, failing the test.
  • second, even if the first issue is fixed, the include_immature_coinbase is set to True; this causes the total balance to be 25.3 + fee instead of 0.3 since node[1] is receiving the coinbase amount in addr_with_multiple_txs from node[0]'s mining.

Make sure tests in CI are all passing!

Can confirm, tested locally and this is exactly what happened.

assert_equal(balance, Decimal("0.3"))

# Test invalid address format error
assert_raises_rpc_error(-5, "Invalid Bitcoin address", self.nodes[1].getreceivedbyaddress, "invalid_address")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would make sense to have this change in a separate commit for each commit to address only one of the issues presented in the goals of the PR.


self.log.info("listreceivedbylabel + getreceivedbylabel Test")

# set pre-state
Expand All @@ -144,7 +156,7 @@ def run_test(self):
{"label": label},
received_by_label_json)

# getreceivedbyaddress should return same balance because of 0 confirmations
# getreceivedbylabel should return same balance because of 0 confirmations

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a necessary cleanup, but don't forget to add it in the PR description.
Also, it could be nice to put preparatory cleanups on a separate commit.

balance = self.nodes[1].getreceivedbylabel(label)
assert_equal(balance, balance_by_label)

Expand Down
Loading