From 372750e91ef7dc40fee52e833a27c1215f2cd1cf Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Sun, 24 May 2020 07:56:38 +0000 Subject: [PATCH] fix nil pointer of block Signed-off-by: Leo Chen --- core/block_validator.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/block_validator.go b/core/block_validator.go index 4ed9f36bd..6d3fdd3b9 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -125,6 +125,9 @@ 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 { + if block == nil { + return errors.New("block is nil") + } if h := block.Header(); h != nil { return v.engine.VerifyHeader(v.bc, h, true) }