-
Notifications
You must be signed in to change notification settings - Fork 38.8k
refactor: deduplicate AmountFromValue() functions #28134
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
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsReviewers, 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. |
19512ca to
bce09e3
Compare
|
Rebased for merge of #28113. |
|
Also not sure. This might remove the duplicate Generally, I think that anytime you're putting the return type of a function into it's name, something is going a bit wrong. Given in this case it's because we've already got a function called |
stickies-v
left a comment
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 I'm approach NACK. A lot of change, and a more cluttered rpc/util interface just for the sake of removing this function from bitcoin-tx.
Isn't something like this a lot less overhead, if this is something we want to improve? stickies-v@d513041 . I'm not sure introducing the rpc/util.h dependency is even worth it, but that's happening in this implementation too so at least that's not worse.
|
Also nit: I don't understand why 709acdc359edbdc7afed15d12278cfc24220376b and 072af572b41d840a2ca53ffb3c8a1613dd4610c4 are 2 commits, that's just making review more difficult? |
|
What's the status of this? Seems to have 2 |
|
It makes sense not to duplicate the common logic, and preferably to extract it to a single point of truth. Reviewers mentioned this in the thread at #19092 (comment), where I wanted to use Edit: I've updated the pull description with this info. I'll re-look at the implementation here and see if it can be improved, or extracted to its own file. |
|
Thanks @stickies-v, I hadn't seen your suggestion. |
Ok. Marked as a draft for now then. |
bce09e3 to
fb099b3
Compare
fb099b3 to
5c2ace2
Compare
to a common method / single point of truth. This also allows us to call it from other non-RPC code like src/bitcoin-cli.cpp
5c2ace2 to
fc94ead
Compare
|
Bringing out of draft. Updated in latest push:
|
|
🐙 This pull request conflicts with the target branch and needs rebase. |
|
⌛ There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
|
Will re-open in a new PR. |
It makes sense to deduplicate this logic and merge it to a single point of truth.
Reviewers mentioned this in the thread at #19092 (comment), where I wanted to use
AmountFromValue()inbitcoin-cli.cpp, making yet another (third) copy of that same function.