-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: extract buildSignHash outside acquiring cs #6915
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
refactor: extract buildSignHash outside acquiring cs #6915
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
WalkthroughIn Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Rationale: Single file, one method, straightforward caching optimization with no logic changes. Verification requires only confirming the cached value is identical to what was previously computed twice and that all call sites receive the correct value. 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). (11)
🔇 Additional comments (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 |
|
|
||
| MessageProcessingResult CSigSharesManager::HandleNewRecoveredSig(const llmq::CRecoveredSig& recoveredSig) | ||
| { | ||
| auto signHash = recoveredSig.buildSignHash().Get(); |
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.
nit: there's no reason to put auto everywhere.
| auto signHash = recoveredSig.buildSignHash().Get(); | |
| uint256 signHash{recoveredSig.buildSignHash().Get()}; |
| auto signHash = recoveredSig.buildSignHash().Get(); | ||
| LOCK(cs); | ||
| RemoveSigSharesForSession(recoveredSig.buildSignHash().Get()); | ||
| RemoveSigSharesForSession(signHash); |
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.
or even better
SignHash hash{recoveredSig.buildSignHash()};
LOCK(cs);
RemoveSigSharesForSession(hash.Get());
UdjinM6
left a comment
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.
Using SignHash here, in RemoveSigSharesForSession etc. might be a good idea for future refactoring but it's out-of-scope for this PR imo.
utACK d8bd26a
Issue being fixed or feature implemented
extract recoveredSig.buildSignHash from mutex
dash/src/llmq/signhash.cpp
Lines 14 to 22 in fd6ad86
buildSignHash is non-trivial; let's extract it to avoid locking cs longer than needed.
How Has This Been Tested?
Breaking Changes
None
Checklist:
Go over all the following points, and put an
xin all the boxes that apply.