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

fix(kademlia): check if peer is blocklisted before connection #2976

Merged
merged 3 commits into from
May 25, 2022

Conversation

istae
Copy link
Member

@istae istae commented May 23, 2022

Checklist

  • I have read the coding guide
  • My change requires a documentation update and I have done it
  • I have added tests to cover my changes.

Description

Motivation and context (Optional)

Related Issue (Optional)

Screenshots (if appropriate):


This change is Reviewable

@@ -930,6 +930,10 @@ func (k *Kad) connect(ctx context.Context, peer swarm.Address, ma ma.Multiaddr)

k.metrics.TotalOutboundConnectionAttempts.Inc()

if blocklisted, _ := k.p2p.Blocklisted(peer); blocklisted {
Copy link
Member

Choose a reason for hiding this comment

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

@istae WDYT about having these checks directly inside the connectNeighbours and connectBalanced methods? this way we won't even pick the peer and try to connect to it, picking unsanctioned peers directly.

@istae istae requested a review from acud May 23, 2022 14:09
@istae istae requested a review from acud May 24, 2022 13:16
@istae istae added the ready for review The PR is ready to be reviewed label May 24, 2022
@istae istae added this to the 1.6.1 milestone May 24, 2022
@istae istae merged commit 7fe46d7 into master May 25, 2022
@istae istae deleted the connect-blocklist branch May 25, 2022 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull-request ready for review The PR is ready to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants