Skip to content

Conversation

@andrewtoth
Copy link
Contributor

This PR merges the tally code of getreceivedbyaddress and getreceivedbylabel into a single function GetReceived. This reduces repeated code and makes it similar to listreceivedbyaddress and listreceivedbylabel, which use the function ListReceived. It will also make the change in #14707 simpler and easier to review.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 24, 2019

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@andrewtoth andrewtoth force-pushed the getreceivedby-refactor branch from 2377697 to 915a40a Compare November 25, 2019 23:11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This uses the multiple address case, used by getreceivedbylabel, and the singular case used by getreceivedbyaddress is no longer needed.

Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

Concept ACK, left a view code review comments (mostly nits though)

@andrewtoth andrewtoth force-pushed the getreceivedby-refactor branch from 915a40a to 994ffd6 Compare January 25, 2020 01:26
@andrewtoth
Copy link
Contributor Author

@theStack thank you for the review. I've addressed all comments.

@andrewtoth andrewtoth force-pushed the getreceivedby-refactor branch 2 times, most recently from dcd65c8 to 4111967 Compare January 26, 2020 04:04
Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

ACK 4111967

@sipa
Copy link
Member

sipa commented Mar 27, 2020

utACK 4111967281a37cfe0d34802a80dba0715bfe3ffb

Nice cleanup, and also nice to hoist the DepthInMainChain check out of the inner loop.

Optionally, since this is more than a pure code move, some of the variable names/comments could be improved as well (the "addresses" variable name, as well as the comment referring to pubkeys are outdated).

@andrewtoth andrewtoth force-pushed the getreceivedby-refactor branch from 4111967 to a1d5b12 Compare March 27, 2020 18:29
Copy link
Contributor

@theStack theStack left a comment

Choose a reason for hiding this comment

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

re-ACK a1d5b12

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

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

utACK a1d5b12

Comment on lines +600 to +603
// Minimum confirmations
int min_depth = 1;
if (!params[1].isNull())
min_depth = params[1].get_int();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Minimum confirmations
int min_depth = 1;
if (!params[1].isNull())
min_depth = params[1].get_int();
const int min_depth{params[1].isNull() ? 1 : params[1].get_int()};

can be written shorter

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 20, 2020
…eived function

a1d5b12 Merge getreceivedby tally into GetReceived function (Andrew Toth)

Pull request description:

  This PR merges the tally code of `getreceivedbyaddress` and `getreceivedbylabel` into a single function `GetReceived`. This reduces repeated code and makes it similar to `listreceivedbyaddress` and `listreceivedbylabel`, which use the function `ListReceived`. It will also make the change in bitcoin#14707 simpler and easier to review.

ACKs for top commit:
  theStack:
    re-ACK bitcoin@a1d5b12
  meshcollider:
    utACK a1d5b12

Tree-SHA512: 43d9cd92f7c2c6a8b9c7509aa85a9b9233a6cfec1c43a9062e3bdfb83515413d1feafa8938c828351278ba22bd31c47e62ab5341e4bddc2493103b094d73b047
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 15, 2020
…d function

Summary:
a1d5b12ec07d2f7aa9fa955a6dd99e8a2be5cb25 Merge getreceivedby tally into GetReceived function (Andrew Toth)

Pull request description:

  This PR merges the tally code of `getreceivedbyaddress` and `getreceivedbylabel` into a single function `GetReceived`. This reduces repeated code and makes it similar to `listreceivedbyaddress` and `listreceivedbylabel`, which use the function `ListReceived`. It will also make the change in #14707 simpler and easier to review.

ACKs for top commit:
  theStack:
    re-ACK bitcoin/bitcoin@a1d5b12
  meshcollider:
    utACK a1d5b12ec07d2f7aa9fa955a6dd99e8a2be5cb25

---

Backport of Core [[bitcoin/bitcoin#17579 | PR17579]]

Test Plan:
  ninja all check check-functional

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D7939
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
@andrewtoth andrewtoth deleted the getreceivedby-refactor branch August 17, 2023 20:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants