From c0d4d20e881c2bf4f046f087f1d21e8ee4064b2b Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Sat, 23 May 2020 23:23:26 -0700 Subject: [PATCH] fix a nil pointer crash due to previous revert Signed-off-by: Leo Chen --- core/block_validator.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/block_validator.go b/core/block_validator.go index 91957b0fb..4ed9f36bd 100644 --- a/core/block_validator.go +++ b/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 // via the VerifySeal method. 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