-
Notifications
You must be signed in to change notification settings - Fork 1.2k
perf: bail out in RelayInvFiltered early if !CanRelay #6910
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
perf: bail out in RelayInvFiltered early if !CanRelay #6910
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
WalkthroughThe pull request modifies relay filtering logic in Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes The changes involve logic modifications to network relay filtering in a critical subsystem. While contained to a single file and two related functions, the reviewer must carefully verify that the divergent behaviors are intentional: one path tightens filtering with an upfront capability check, while the other relaxes it by removing the check. Understanding the rationale for these opposing changes and their broader implications on relay behavior requires careful analysis despite the limited file scope. Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)src/**/*.{cpp,h,cc,cxx,hpp}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| { | ||
| // TODO: Migrate to iteration through m_peer_map | ||
| m_connman.ForEachNode([&](CNode* pnode) { | ||
| if (!pnode->CanRelay()) return; |
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.
Consider TODO above, if you have touched this code
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.
At some point, I may try to, but it's non-trivial
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.
LGTM a425211
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.
utACK a425211
Issue being fixed or feature implemented
m_peer_mutex, acquired in GetPeerRef, is relatively highly contended. Move the pnode->CanRelay up higher to bail out early if possible and avoid the need to acquire m_peer_mutex.
What was done?
How Has This Been Tested?
Builds
Breaking Changes
Checklist:
Go over all the following points, and put an
xin all the boxes that apply.