Skip to content

Commit

Permalink
Add gasUsed check for epoch data query (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanliqun authored Dec 13, 2024
1 parent 66b005d commit 0d89260
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions store/epoch_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ func queryEpochData(cfx sdk.ClientOperator, epochNumber uint64, useBatch bool) (
}

func validateBlock(block *types.Block, epochNumber uint64, hash types.Hash) error {
if block.GasUsed == nil { // block is not executed yet?
return errors.WithMessage(errBlockValidationFailed, "gas used is nil")
}

if block.EpochNumber == nil {
return errors.WithMessage(errBlockValidationFailed, "epoch number is nil")
}
Expand Down

0 comments on commit 0d89260

Please sign in to comment.