-
Notifications
You must be signed in to change notification settings - Fork 37.7k
refactor: P2P transport without serialize version and type #28892
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. Code CoverageFor detailed information about the code coverage, see the test coverage report. 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. |
src/net_processing.cpp
Outdated
@@ -1985,7 +1985,7 @@ void PeerManagerImpl::BlockDisconnected(const std::shared_ptr<const CBlock> &blo | |||
void PeerManagerImpl::NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& pblock) | |||
{ | |||
auto pcmpctblock = std::make_shared<const CBlockHeaderAndShortTxIDs>(*pblock); | |||
const CNetMsgMaker msgMaker(PROTOCOL_VERSION); | |||
const NetMsgMaker msgMaker{}; |
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.
Why not const NetMsgMaker msgMaker;
with no curly brackets?
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 like {}
, because it has many benefits:
- No need for code readers to waste brain cycles on thinking whether an initialization was missed
- A smaller
--word-diff-regex=.
, when in the future a designated initializer or constructor argument is added - I looks nice
The field is unused, so remove it. This is also required for future commits.
fa96619
to
fade05b
Compare
utACK fade05b I'm also ok with a commit in this PR to drop |
ACK fade05b |
3333fdf
to
fa3e1ff
Compare
Removed the class and replaced it with a template function in a namespace to address the feedback of both reviewers (Thanks!) |
fa3e1ff
to
dddd999
Compare
The nVersion field is unused, so remove it. This is also required for future commits. Also, add PushMessage aliases in PeerManagerImpl to make calling code less verbose. Co-Authored-By: Anthony Towns <aj@erisian.com.au>
dddd999
to
fafd5e5
Compare
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.
ACK fafd5e5
fafd5e5
to
fa79a88
Compare
reACK fa79a88 |
Now that the serialize framework ignores the serialize version and serialize type, everything related to it can be removed from the code.
This is the first step, removing dead code from the P2P stack. A different pull will remove it from the wallet and other parts.