fix a nil pointer crash due to previous revert

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3091/head
Leo Chen 5 years ago
parent de0cbd44c2
commit afd2e4f63b
  1. 5
      core/block_validator.go

@ -125,7 +125,10 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.DB, re
// given engine. Verifying the seal may be done optionally here, or explicitly // given engine. Verifying the seal may be done optionally here, or explicitly
// via the VerifySeal method. // via the VerifySeal method.
func (v *BlockValidator) ValidateHeader(block *types.Block, seal bool) error { func (v *BlockValidator) ValidateHeader(block *types.Block, seal bool) error {
return v.engine.VerifyHeader(v.bc, block.Header(), true) if h := block.Header(); h != nil {
return v.engine.VerifyHeader(v.bc, h, true)
}
return errors.New("header field was nil")
} }
// ValidateHeaders verifies a batch of blocks' headers concurrently. The method returns a quit channel // ValidateHeaders verifies a batch of blocks' headers concurrently. The method returns a quit channel

Loading…
Cancel
Save