eth/hooks: fix missing nil check, close XFN-114 #1695#1937
eth/hooks: fix missing nil check, close XFN-114 #1695#1937AnilChinchawale merged 1 commit intoXinFinOrg:v2.6.x-betafrom
nil check, close XFN-114 #1695#1937Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 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 |
There was a problem hiding this comment.
Pull request overview
This PR fixes a nil pointer dereference panic by adding nil checks when retrieving blocks and headers. The panic occurred in engine_v2_hooks.go when calling block.Transactions() on a nil block pointer.
Key Changes
- Added nil check for
chain.GetBlock()result in the penalty calculation hook (line 126-129) - Added nil check with error handling for
chain.GetHeader()result in theGetSigningTxCountfunction (lines 242-247)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b73dcdb to
41d3a4f
Compare
Proposed changes
pick some missing codes from #1695
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which part of the codebase this PR will touch base on,
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that