refactor: remove GetBlockHash helper, use CChain::operator[] directly#7334
refactor: remove GetBlockHash helper, use CChain::operator[] directly#7334knst wants to merge 1 commit into
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
WalkthroughThis PR removes the Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
Verified the refactor at commit c98fdc8. Removing the single-use GetBlockHash helper in favor of CChain::operator[] is behavior-preserving at the sole call site: caller asserts cs_main is held (line 489) making the dropped internal lock redundant, computed quorumStartHeight is always non-negative so the -1 sentinel was unreachable, and operator[] returns nullptr on out-of-range/empty-chain matching the prior false-return contract. No agent or CodeRabbit findings to validate.
Reviewed commit: c98fdc8
Issue being fixed or feature implemented
Single-use helper that calls
CChain::operator[]with extra checks but it has unexpected behaviour for value -1 [it returns tip] but caller never has it.Better to remove it to prevent misusages in the future, also to clean up global namespace.
What was done?
Removed GetBlockHash from global namespace and its only usage replaced to operator[] call.
How Has This Been Tested?
N/A
Breaking Changes
N/A
Checklist: