-
Notifications
You must be signed in to change notification settings - Fork 37.7k
[net processing] Move Misbehaving() to PeerManager #19791
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 PR title only addresses one of the many commits (the last one), I assume you either wanted to only include this commit or change the title to be more general to also include all other changes. |
The object of this PR is to move Misbehaving to PeerLogicValidation. The other commits are necessary to do that because they all eventually call in to Misbehaving: https://doxygen.bitcoincore.org/net__processing_8cpp.html#ad2983e754c4d90bd68adf91b208664f5 |
Thanks for clarifying, that makes sense. (And it's the first time in my life that a generated caller graph by Doxygen actually is of any help and not confusing ;-)) |
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. |
Concept ACK |
( Note to myself: commit eb17009 with this diff #19704 (comment) should pass the unit tests again ) |
c7b23e4
to
072bee4
Compare
Thanks @MarcoFalke . I've cherrypicked that commit into this branch, which reduced further the number of parameters in some of these moved functions. |
072bee4
to
f062ca2
Compare
Rebased |
f062ca2
to
b9486cc
Compare
Concept ACK |
Almost ACK. Please use a scripted diff where appropriate:
ACK b9486cc 🍳 Exclusively move-only and rename-only changes. The only risk I see would be
Show signature and timestampSignature:
Timestamp of file with hash |
b9486cc
to
ab9e416
Compare
Thanks for the review @MarcoFalke ! I've taken your suggestion of making the rename a scripted diff (and added a follow-up commit that fixes the indentation). |
re-ACK ab9e416 🔋 Show signature and timestampSignature:
Timestamp of file with hash |
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 7ed1612
re-ACK 7ed1612 only change is in commit message 💮 Show signature and timestampSignature:
Timestamp of file with hash |
We don't have a project style for ordering class members, but it always makes sense to have no more than one of each public/protected/private specifier. Also move documentation for MaybeDiscourageAndDisconnect to the header.
Keep a references to chainparams, rather than calling the global Params() function every time it's needed. This is fine, since globalChainParams does not get updated once it's been set, and it's available at the point of constructing the PeerLogicValidation object.
…ager -BEGIN VERIFY SCRIPT- sed -i 's/PeerLogicValidation/PeerManager/g' $(git grep -l PeerLogicValidation ./src ./test) sed -i 's/peer_logic/peerman/g' $(git grep -l peer_logic ./src ./test) -END VERIFY SCRIPT- PeerLogicValidation was originally net_processing's implementation to the validation interface. It has since grown to contain much of net_processing's logic. Therefore rename it to reflect its responsibilities. Suggested in bitcoin#10756 (review).
7ed1612
to
bb6a32c
Compare
rebased on master. Also updated |
re-ACK bb6a32c only change is rebase due to conflict in struct NodeContext and variable rename 🤸 Show signature and timestampSignature:
Timestamp of file with hash |
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.
Summary: ``` We don't have a project style for ordering class members, but it always makes sense to have no more than one of each public/protected/private specifier. Also move documentation for MaybeDiscourageAndDisconnect to the header. ``` Partial backport of core [[bitcoin/bitcoin#19791 | PR19791]] (1/9): bitcoin/bitcoin@824bbd1 Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D8940
Summary: ``` Keep a references to chainparams, rather than calling the global Params() function every time it's needed. This is fine, since globalChainParams does not get updated once it's been set, and it's available at the point of constructing the PeerLogicValidation object. ``` Partial backport of core [[bitcoin/bitcoin#19791 | PR19791]] (2/9): bitcoin/bitcoin@2297b26 Test Plan: ninja all check-all Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D8942
…ager Summary: ``` -BEGIN VERIFY SCRIPT- sed -i 's/PeerLogicValidation/PeerManager/g' $(git grep -l PeerLogicValidation ./src ./test) sed -i 's/peer_logic/peerman/g' $(git grep -l peer_logic ./src ./test) -END VERIFY SCRIPT- PeerLogicValidation was originally net_processing's implementation to the validation interface. It has since grown to contain much of net_processing's logic. Therefore rename it to reflect its responsibilities. ``` Partial backport (3/9) of core [[bitcoin/bitcoin#19791 | PR19791]]: bitcoin/bitcoin@58bd369 Since the name conflicts with avalanche's PeerManager in tests, the full namespaced class name is used. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Subscribers: PiRK Differential Revision: https://reviews.bitcoinabc.org/D9037
Summary: Partial backport (4/9) of core [[bitcoin/bitcoin#19791 | PR19791]]: bitcoin/bitcoin@d777835 Depends on D9037. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9038
Summary: Partial backport (5/9) of core [[bitcoin/bitcoin#19791 | PR19791]]: bitcoin/bitcoin@b70cd89 Depends on D9038. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9043
Summary: Partial backport (6/9) of core [[bitcoin/bitcoin#19791 | PR19791]]: bitcoin/bitcoin@e662e2d Depends on D9043. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9044
Summary: Partial backport (7/9) of core [[bitcoin/bitcoin#19791 | PR19791]]: bitcoin/bitcoin@3115e00 Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9047
Summary: Partial backport (8/9) of core [[bitcoin/bitcoin#19791 | PR19791]]: bitcoin/bitcoin@aa114b1 Depends on D9047. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, PiRK Reviewed By: #bitcoin_abc, PiRK Differential Revision: https://reviews.bitcoinabc.org/D9048
Summary: Completes backport (9/9) of core [[bitcoin/bitcoin#19791 | PR19791]]: bitcoin/bitcoin@bb6a32c Depends on D9048. Also moves the other `Misbehaving()` prototype (specific to our codebase) as a private method. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D9049
Continues the work of moving net_processing logic into PeerLogicValidation. See #19704 and #19607 (comment) for motivation.
This PR also renames
PeerLogicValidation
toPeerManager
as suggested in #10756 (review).