Skip to content

Wallet: "listreceivedby*" fix #30972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

BrandonOdiwuor
Copy link
Contributor

Fixes #16159,

This PR builds on #25973, fixing listreceivedby* RPCs by filtering out send addresses using IsMine (see #25973 (comment)). It also breaks down the listreceivedby tests into subtests and adds a test to verify 'listreceivedby*' does not return send addresses

@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 25, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/30972.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

No conflicts as of last run.

@BrandonOdiwuor BrandonOdiwuor marked this pull request as draft September 25, 2024 17:08
@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/30659059850

Hints

Make sure to run all tests locally, according to the documentation.

The failure may happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

@BrandonOdiwuor BrandonOdiwuor force-pushed the wallet-listreceivedby-fix branch from 209303b to a35115f Compare September 26, 2024 04:24
@BrandonOdiwuor BrandonOdiwuor changed the title Wallet listreceivedby fix Wallet: "listreceivedby*" fix Sep 26, 2024
@BrandonOdiwuor BrandonOdiwuor marked this pull request as ready for review September 26, 2024 05:09
@DrahtBot DrahtBot added Wallet and removed CI failed labels Sep 26, 2024
@polespinasa
Copy link
Contributor

polespinasa commented Nov 13, 2024

Lgtm
Tested ack a35115f

I ran the unit test and functional test (without bdb) and all pass.
Also tested manually using regtest the steps in function test_listreceivedby and the behaviour is the expected.

@fanquake
Copy link
Member

Maybe @achow101 or @furszy want to review here?

Comment on lines +144 to +146
LOCK(wallet.cs_wallet);
if (!wallet.IsMine(address)) return; // no send addresses

Copy link
Member

@furszy furszy Mar 11, 2025

Choose a reason for hiding this comment

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

Since the mapTally loading procedure already performs the IsMine check, we could use that instead of executing it again for the addresses that received some coins.
In other words, if an element exists in mapTally, we can be certain that everything inside it belongs to the wallet.

So, ideally, we could decouple the mapTally existence check from the "include empty" check (the one that is just below this line), which would avoid this second IsMine() call for the non-empty addresses (we would need to execute it for the addresses that have no associated value in mapTally).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

listrecievedbyaddress with include_empty not filtering out "send" side of address book
5 participants