Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
check nil case
Browse files Browse the repository at this point in the history
  • Loading branch information
fedekunze committed Nov 25, 2020
1 parent 6c31ea2 commit f5033f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions x/evm/types/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ func GetHashFn(ctx sdk.Context) vm.GetHashFunc {

// get the Tendermint block hash from the current header
tmBlockHash := tmHeader.Hash()

// NOTE: if the validator set hash is missint the hash will be returned as nil
// so we need to check for this case to prevent a panic when calling Bytes()
if tmBlockHash == nil {
return common.Hash{}
}

return common.BytesToHash(tmBlockHash.Bytes())
}
}
Expand Down

0 comments on commit f5033f5

Please sign in to comment.