-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: cleanup/followup of Remove -deprecatedrpc=addresses flag #22924
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
Marking this as a draft for now. I will be moving some of the refactoring/cleanup that was originally included in #22650 to this PR. So once that is done and I've rebased this PR, I will reopen it |
1e8c0c5
to
e749168
Compare
Now that #22650 is merged, I rebased and finished this. This PR follows up with some cleanup, and addresses all the comments in the first PR that were left for now. Just so we have them at-hand, I took all the original comments from #22650's review, and am putting them here.
Done b9ad1d9
and
Done e9f3f1b
Done fe71ac8
and
Done e749168 |
e749168
to
08543bf
Compare
08543bf
to
1402f0d
Compare
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. |
1402f0d
to
570cbb7
Compare
Rebased, fixed some merge conflicts from #22918 |
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool include_hex, bool include_address = true); | ||
void ScriptToUniv(const CScript& script, UniValue& out); | ||
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr, TxVerbosity verbosity = TxVerbosity::SHOW_DETAILS); | ||
void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex = true, bool include_address = false); |
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 wonder why we don't return the UniValue (or optional<UniValue>
in case it can fail) instead of having it as second parameter. It would seem better API design to me.
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 great suggestion. And at first glance it seems to be straightforward enough to include in this PR. I'll follow up shortly
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 am leaning towards not including this change in this PR. I do think it is a great opportunity to cleanup and improve the code quality, so I would like to follow up with another PR doing this. This pattern is also used all over the place, not just ScriptToUniv
, but TxToUniv
, entryToJSON
, and probably more. Anyways I want to spend some more time on this and don't want to end up doing too much in this PR
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.
Can you take a quick look at the last two commits in this draft PR #23507?
a) is this along the lines of what you are thinking?
b) do you think it is worthwhile for me to do this across the codebase in #23507, eg entryToJSON
, TxToJSON
, etc... can be improved in the same way
Feel free to answer those in the linked PR and not here
570cbb7
to
9d8cd50
Compare
9d8cd50
to
d4675f4
Compare
Addressed indentation nit and rebased to master |
886fac7
to
d4675f4
Compare
@@ -1274,7 +1274,7 @@ static RPCHelpMan gettxout() | |||
{RPCResult::Type::STR, "asm", ""}, | |||
{RPCResult::Type::STR_HEX, "hex", ""}, | |||
{RPCResult::Type::STR, "type", "The type, eg pubkeyhash"}, | |||
{RPCResult::Type::STR, "address", /* optional */ true, "The Bitcoin address (only if a well-defined address exists)"}, | |||
{RPCResult::Type::STR, "address", /* optional */ true, DESTINATION_ADDRESS}, |
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.
it might be better to de-duplicate the whole asm/hex/type/address blob. Though, maybe create a separate pull for doc cleanups vs code refactorings?
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.
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 good suggestion. I will do this as a followup as you suggest. So I will get rid of 63a657c when I rebase and have a doc cleanup followup with these suggestions
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
I guess it is hard to tell how much of this is still relevant without doing a rebase? |
I've rebased some of the commits here in #24673. Haven't done 63a657c as we might be able to follow up differently there, and do some de-duplication, see #22924 (comment). |
9563a64 refactor: add stdd:: includes to core_write (fanquake) 8b9efeb refactor: use named args when ScriptToUniv or TxToUniv are invoked (Michael Dietz) 22f25a6 refactor: prefer snake case, TxToUniv arg hashBlock renamed block_hash (Michael Dietz) 828a094 refactor: merge ScriptPubKeyToUniv & ScriptToUniv into one function (Michael Dietz) Pull request description: I've cherry-picked some of the commits out of #22924, and made minor changes (like fixing named args). ACKs for top commit: MarcoFalke: re-ACK 9563a64 🕓 Tree-SHA512: 4f0e5b45c14cbf68b9e389bbe1211c125d95cbd3da5205b1cff6a4c44f15b15039ba2a5b25cd7e2580d9169404f1b7ff620d8a7e01f6112e3cb153ecfaef8916
This is a follow-up on top of #22650. Based on review there, we thought it would be an improvement to merge
ScriptPubKeyToUniv
andScriptToUniv
into a single function, but this didn't seem to belong in that PR. There are a few other minor cleanups here as well focused on style and making some fuzz tests run faster