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

rpc: handle crash on empty safe block #532

Merged
merged 1 commit into from
Oct 15, 2024
Merged

rpc: handle crash on empty safe block #532

merged 1 commit into from
Oct 15, 2024

Conversation

MatusKysel
Copy link
Collaborator

No description provided.

@@ -97,8 +97,9 @@ func _GetBlockNumber(ctx context.Context, requireCanonical bool, blockNrOrHash r
case rpc.SafeBlockNumber:
if fs := parliafinality.GetFinalizationService(); fs != nil {
blockHash := fs.GetSafeBlockHash()
blockNum := rawdb.ReadHeaderNumber(tx, blockHash)
return *blockNum, blockHash, false, nil
if blockNum := rawdb.ReadHeaderNumber(tx, blockHash); blockNum != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why blockNum would be nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe after sync, before finalize in parlia is called safe hash is empty one, but I couldn't reproduce it I had to go over the code and find potential issue

@blxdyx blxdyx merged commit 4df9747 into main Oct 15, 2024
8 checks passed
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.

Cannot request eth_getBlockByNumber("safe", false) while syncing
2 participants