Skip to content
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

port the fix from go-ethereum for interface conversion panic #2816

Conversation

gupadhyaya
Copy link
Contributor

No description provided.

@gupadhyaya gupadhyaya requested a review from LeoHChen April 12, 2020 05:53
@@ -240,6 +240,9 @@ func NewBlockChain(
if bc.genesisBlock == nil {
return nil, ErrNoGenesis
}
var nilBlock *types.Block
Copy link
Contributor

Choose a reason for hiding this comment

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

What is context for this fix and why a nil pointer solves it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this fixes it because this is still a nil pointer. The code will explode because loadLastState will probably explode via currentBlock.Root() or something else because many things will call something on block which will use header.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is not a generic fix, but it will surely fix the exact stack trace mentioned in the above issue that happens due to interface conversion from nil to *types.Block.

@fxfactorial fxfactorial merged commit a732b52 into harmony-one:master Apr 12, 2020
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.

3 participants