Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
RPC/Wallet: Add "use_txids" to output of getaddressinfo #22693
base: master
Are you sure you want to change the base?
RPC/Wallet: Add "use_txids" to output of getaddressinfo #22693
Changes from all commits
fc7954a
022887d
a00bc6f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In c961db6 "RPC/Wallet: Add "use_txids" to output of getaddressinfo"
Without having read the help text, I'm having a hard time figuring out the meaning of this field. My initial reading had "use" as a verb, but that doesn't make sense. I think it might be clearer to rename this to something like
used_in_txids
orreceived_with_txids
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment was marked as resolved but nothing was changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "Wallet: Add fairly-efficient [negative] check that an address is not known to be used" (16ad058)
I understand this code may need to get more complicated in a future PR, but in this PR I think it would be better to replace
with a simpler:
It would make this PR easier to review and understand, and make test coverage better by not adding untested code. And
std::function
is nullable, so the monostate case could just correspond to the null case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think it's worth it to change this now just to revert it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: #22693 (comment)
Sure, I can see how knowing the output index would be useful. But in that case replacing the std::variant with just:
would simplify this function a lot and not complicate the rpc much at all (would just add an unused parameter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "Wallet: Keep track of what addresses are used in wallet transactions (memory only)" (fc7954a)
Would suggest moving this next to the
previously_spent
member below and naming itpreviously_received
instead ofm_used
. Calling it "used" is ambiguous and confusing because at the walletdb level, "used" indicates whether funds sent to the address have previously been spent, not whether funds were sent to the address.Other names for "previously_received" / "previously_spent" could work too of course, but "used" seems too ambiguous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In commit "Wallet: Keep track of what addresses are used in wallet transactions (memory only)" (fc7954a)
This workaround is not really sufficient because it fixes the address book count for the wallet tool without fixing it for the bitcoind wallet:
bitcoin/src/wallet/wallet.cpp
Line 3171 in 1ac627c
Ideally no workaround might be necessary if we could avoid adding extra entries to
m_address_book
(see #22693 (comment)). But assuming a workaround is necessary, it could be implemented more simply in both places with a newCAddressBookData
method:used with
std::count_if
instead ofm_address_book.size()
to return number of address book entries.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In c961db6 "RPC/Wallet: Add "use_txids" to output of getaddressinfo"
nit: Does this address have to be hardcoded? I think we want to avoid hardcoding things like this in tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should avoid hardcoded stuff, but I noticed this address is hardcoded right before when testing
getaddressinfo
, probably to test scriptPubKey. Anyway, I think we could move it to a variable and use it whatever we need.