Skip to content

Conversation

@gzliudan
Copy link
Collaborator

@gzliudan gzliudan commented Jan 9, 2026

Proposed changes

pick some missing codes from #1695

xinfinnetwork_1  | panic: runtime error: invalid memory address or nil pointer dereference
xinfinnetwork_1  | [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x65d5e0]
xinfinnetwork_1  |
xinfinnetwork_1  | goroutine 118729 [running]:
xinfinnetwork_1  | github.com/XinFinOrg/XDPoSChain/core/types.(*Block).Transactions(0x4bee88083292c1d2?)
xinfinnetwork_1  |      /builder/core/types/block.go:341
xinfinnetwork_1  | github.com/XinFinOrg/XDPoSChain/eth.New.AttachConsensusV2Hooks.func6({0x182ad68, 0xc000330630}, 0xc013d4c900, {0xce, 0x50, 0xd, 0xec, 0x82, 0x7e, 0xc6, ...}, ...)
xinfinnetwork_1  |      /builder/eth/hooks/engine_v2_hooks.go:126 +0xf77
xinfinnetwork_1  | github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/engines/engine_v2.(*XDPoS_v2).calcMasternodes(0xc0001be2c0, {0x182ad68, 0xc000330630}, 0xc013d4c900, {0xb, 0x1c, 0xea, 0xa7, 0x47, 0xa5, ...}, ...)
xinfinnetwork_1  |      /builder/consensus/XDPoS/engines/engine_v2/engine.go:1117 +0x188
xinfinnetwork_1  | github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/engines/engine_v2.(*XDPoS_v2).verifyHeader(0xc0001be2c0, {0x182ad68, 0xc000330630}, 0xc0135ca508, {0xc01a6dceb0, 0x0, 0x1cea2b7668?}, 0x1)
xinfinnetwork_1  |      /builder/consensus/XDPoS/engines/engine_v2/verifyHeader.go:135 +0xd97
xinfinnetwork_1  | github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/engines/engine_v2.(*XDPoS_v2).VerifyHeaders.func1()
xinfinnetwork_1  |      /builder/consensus/XDPoS/engines/engine_v2/engine.go:585 +0x136
xinfinnetwork_1  | created by github.com/XinFinOrg/XDPoSChain/consensus/XDPoS/engines/engine_v2.(*XDPoS_v2).VerifyHeaders in goroutine 7852
xinfinnetwork_1  |      /builder/consensus/XDPoS/engines/engine_v2/engine.go:583 +0x105

Types of changes

What types of changes does your code introduce to XDC network?
Put an in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Regular KTLO or any of the maintaince work. e.g code style
  • CICD Improvement

Impacted Components

Which part of the codebase this PR will touch base on,

Put an in the boxes that apply

  • Consensus
  • Account
  • Network
  • Geth
  • Smart Contract
  • External components
  • Not sure (Please specify below)

Checklist

Put an in the boxes once you have confirmed below actions (or provide reasons on not doing so) that

  • This PR has sufficient test coverage (unit/integration test) OR I have provided reason in the PR description for not having test coverage
  • Provide an end-to-end test plan in the PR description on how to manually test it on the devnet/testnet.
  • Tested the backwards compatibility.
  • Tested with XDC nodes running this version co-exist with those running the previous version.
  • Relevant documentation has been updated as part of this PR
  • N/A

@coderabbitai
Copy link

coderabbitai bot commented Jan 9, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 the GetSigningTxCount function (lines 242-247)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AnilChinchawale AnilChinchawale merged commit c759d88 into XinFinOrg:v2.6.x-beta Jan 16, 2026
14 checks passed
@gzliudan gzliudan deleted the fix-v26x-panic branch January 16, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants