Skip to content
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

Simplify IP status calculation #1421

Merged
merged 1 commit into from
Apr 26, 2023
Merged

Conversation

StephenButtolph
Copy link
Contributor

Why this should be merged

connected implies previouslyTracked, so !previouslyTracked && !connected is equal to !previouslyTracked. So, we can avoid an additional set lookup.

How this works

previouslyTracked is true if the peer:

  • was attempted to be connected to in the past
  • is currently in the process of connecting
  • is connected

Because previouslyTracked is true when connected, we can simplify the expression.

How this was tested

It's kind of hard to test that this is dead code...

@StephenButtolph StephenButtolph added the networking This involves networking label Apr 26, 2023
@StephenButtolph StephenButtolph added this to the v1.10.1 milestone Apr 26, 2023
@StephenButtolph StephenButtolph self-assigned this Apr 26, 2023
@StephenButtolph StephenButtolph added the cleanup Code quality improvement label Apr 26, 2023
@StephenButtolph StephenButtolph merged commit 6fb00b9 into dev Apr 26, 2023
@StephenButtolph StephenButtolph deleted the simplify-boolean-expression branch April 26, 2023 15:56
joshua-kim added a commit to joshua-kim/avalanchego that referenced this pull request Apr 27, 2023
commit b11e9bb
Author: Stephen Buttolph <stephen@avalabs.org>
Date:   Wed Apr 26 14:30:28 2023 -0400

    Update BLS signature ordering to avoid public key compression (ava-labs#1416)

commit e44ef23
Author: Stephen Buttolph <stephen@avalabs.org>
Date:   Wed Apr 26 11:57:39 2023 -0400

    Honor AllowPrivateIPs config (ava-labs#1422)

commit 6fb00b9
Author: Stephen Buttolph <stephen@avalabs.org>
Date:   Wed Apr 26 11:56:46 2023 -0400

    Simplify IP status calculation (ava-labs#1421)
joshua-kim pushed a commit to joshua-kim/avalanchego that referenced this pull request Apr 28, 2023
Co-authored-by: abenegia <alberto.benegiamo@gmail.com>
Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code quality improvement networking This involves networking
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants