Skip to content

Conversation

@theStack
Copy link
Contributor

This simple refactoring PR has the goal to improve the readability of the Misbehaving method by

  • introducing constant variables score_before and score_now (to avoid repeatedly calculating the former)
  • deduplicating calls to LogPrint(), eliminates else-branch

@fanquake fanquake added the P2P label Jul 19, 2021
Copy link
Contributor

@lsilva01 lsilva01 left a comment

Choose a reason for hiding this comment

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

Code Review ACK 9459fe5

Copy link
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

tACK 9459fe5

Agreed that the code looks cleaner than before.

Verified p2p_invalid_messages and p2p_filter test producing expected misbehavior.

- introduce constant variables `score_before` and
  `score_after` in order to improve readability
- deduplicate calls to LogPrint(), eliminates else-branch
@theStack theStack force-pushed the 202107-net-tidy_up_misbehaving branch from 9459fe5 to 8858e88 Compare July 26, 2021 13:52
@theStack
Copy link
Contributor Author

Force-pushed with the suggestions by jnewbery (#22495 (comment), #22495 (comment)). Thanks to all reviewers so far!

@jnewbery
Copy link
Contributor

utACK 8858e88

Copy link
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

tACK 8858e88

@maflcko maflcko merged commit f372623 into bitcoin:master Jul 27, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 28, 2021
…ving(...)`

8858e88 p2p: refactor: tidy up `PeerManagerImpl::Misbehaving(...)` (Sebastian Falbesoner)

Pull request description:

  This simple refactoring PR has the goal to improve the readability of the `Misbehaving` method by

  - introducing constant variables `score_before` and  `score_now` (to avoid repeatedly calculating the former)
  - deduplicating calls to LogPrint(), eliminates else-branch

ACKs for top commit:
  jnewbery:
    utACK 8858e88
  rajarshimaitra:
    tACK bitcoin@8858e88

Tree-SHA512: 1d4dd5ac1d16ee9595edf4fa46e4960915a203641d74e6c33cffaba62ea71328834309a4451256fb45daf759f0cf6f4f199c46815afff6c89c0746e2ad4d4092
@theStack theStack deleted the 202107-net-tidy_up_misbehaving branch July 31, 2021 20:04
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants