Removes a bunch of redundant, dead or duplicate code.
Uses the idea from and finishes the idea #28428 by theuni
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.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
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.
Reviewers, 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.
It was never set, so it can be removed along with any code reading it.
81 {
82 if (!HasWitness()) {
83 return hash;
84 }
85- return SerializeHash(*this, SER_GETHASH, 0);
86+ return (CHashWriter{0} << *this).GetHash();
CHashWriter{0}
is pretty ugly. I assume this will be going away though as part of one of the other refactors going on?
HashWriter{}
122@@ -123,20 +123,14 @@ class CKeyPool
123 template<typename Stream>
124 void Serialize(Stream& s) const
125 {
126- int nVersion = s.GetVersion();
127- if (!(s.GetType() & SER_GETHASH)) {
128- s << nVersion;
129- }
130+ s << int{259900}; // Unused field, writes the highest client version ever written
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!
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.