-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Refactor: Improve API design of ScriptToUniv
, TxToUniv
etc to return the UniValue
instead of mutating a parameter/reference
#23507
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
Concept ACK. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. 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. |
a01a216
to
140767e
Compare
ScriptToUniv
, TxToUniv
ScriptToUniv
, TxToUniv
etc to return the UniValue
instead of mutating the parameter/reference
ScriptToUniv
, TxToUniv
etc to return the UniValue
instead of mutating the parameter/referenceScriptToUniv
, TxToUniv
etc to return the UniValue
instead of mutating a parameter/reference
5081cf9
to
82826eb
Compare
82826eb
to
092ad6a
Compare
Does anyone want this PR enough to review it if I rebase? If so I will do a careful rebase/review. If not I'm ok with closing this |
I think this change is worthwhile. If you're happy to do a rebase I'll review it. If not, I'll pick this up. |
…mutating reference
…iValue` reference
20b68de
to
df41d46
Compare
Thanks @fanquake, rebased. I am also going to do a thorough re-review since I did this a while ago. Also I dropped fcffbde for now, I need to take some time to go through @MarcoFalke's #25464 before I rebase this commit. |
🐙 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?
|
TxToUniv(tx, /*block_hash=*/uint256::ZERO, /*entry=*/u); | ||
TxToUniv(tx, /*block_hash=*/uint256::ONE, /*entry=*/u); | ||
(void)TxToUniv(tx, /*block_hash=*/uint256::ZERO); | ||
(void)TxToUniv(tx, /*block_hash=*/uint256::ONE); |
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 this is a bugfix for the fuzz test, which eats too much memory (especially under msan)
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.
Oh man I'm curious how you ended up back in this PR!? Is that just from your memory?
Anyways lmk if you want me to do anything. I'd be happy to rebase this, open a PR with just this commit, etc.. whatever you suggest. Also feel free to just cherry-pick that commit or whatever is most efficient for you as well incase you are just commenting this for documentation purposes
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.
Maybe just split out the TxToUniv
change in a new pull?
Now functions return a
UniValue
instead of mutating a parameter that's passed by reference.After this PR, any time a
UniValue
is passed by reference, it should beconst
. This is the case everywhere in the codebase now (please double check me on this) except forSoftForkDescPushBack
(which I didn't want to touch), and the RPC request handling logic.Motivation for this PR was based on a suggestion in #22924 review:
I figured it's simple enough, why not do this across the entire codebase. Hopefully I didn't get carried away