Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Sep 19, 2023

Removes a bunch of redundant, dead or duplicate code.

Uses the idea from and finishes the idea #28428 by theuni

MarcoFalke added 2 commits September 19, 2023 14:19
GetType() is never called, so it is completely unused and can be
removed.
The type is only ever set, but never read via GetType(), so remove it.
Also, remove SerializeHash to avoid silent merge conflicts and use the
already existing GetHash() boilerplate consistently.
@DrahtBot
Copy link
Contributor

DrahtBot commented Sep 19, 2023

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK kevkevinpal, ajtowns
Concept ACK theuni, stickies-v

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28438 (Use serialization parameters for CTransaction by ajtowns)
  • #28107 (util: Type-safe transaction identifiers by dergoegge)
  • #21283 (Implement BIP 370 PSBTv2 by achow101)

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.

@theuni
Copy link
Member

theuni commented Sep 19, 2023

Concept ACK.

@theuni
Copy link
Member

theuni commented Sep 19, 2023

Mind splitting up the last commit? The version number change needs a bit of scrutiny imo, but it's hidden inside an innocuous commit message.

@maflcko maflcko changed the title refactor: Remove SER_GETHASH type refactor: Remove SER_GETHASH, hard-code client version in CKeyPool serialize Sep 19, 2023
@maflcko
Copy link
Member Author

maflcko commented Sep 19, 2023

Changed the commit title and PR title. Is it good enough?

It was never set, so it can be removed along with any code reading it.
Copy link
Contributor

@kevkevinpal kevkevinpal left a comment

Choose a reason for hiding this comment

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

added one nit but otherwise ACK fac29a0

if (!(s.GetType() & SER_GETHASH)) {
s << nVersion;
}
s << int{259900}; // Unused field, writes the highest client version ever written
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: in the comment does "highest client version ever written" mean that this is the highest client version that can be written or that we've ever seen written?

Suggestion
"Unused field, writes the highest possible client version"

feel free to ignore this nit aswell!

Copy link
Member Author

Choose a reason for hiding this comment

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

It is the current client version written. It should be possible to confirm this by adding an std::cout << nVersion << "\n"; here.

The client version is only increased, so it is also the highest.

In any case, the value doesn't matter, so I am happy to replace it with anything else.

@stickies-v
Copy link
Contributor

Concept ACK

@ajtowns
Copy link
Contributor

ajtowns commented Sep 28, 2023

ACK fac29a0

@fanquake fanquake merged commit 48b8910 into bitcoin:master Oct 2, 2023
@maflcko maflcko deleted the 2309-no-gethash- branch October 3, 2023 09:53
@bitcoin bitcoin locked and limited conversation to collaborators Oct 2, 2024
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