diff --git a/tests/block_test_util.go b/tests/block_test_util.go index 526f0b7c71..6d9e8c808c 100644 --- a/tests/block_test_util.go +++ b/tests/block_test_util.go @@ -162,9 +162,9 @@ func (t *BlockTest) Run(snapshotter bool, scheme string, tracer vm.EVMLogger, po } // Import succeeded: regardless of whether the _test_ succeeds or not, schedule // the post-check to run - defer func() { - postCheck(result, chain) - }() + if postCheck != nil { + defer postCheck(result, chain) + } cmlast := chain.CurrentBlock().Hash() if common.Hash(t.json.BestBlock) != cmlast { return fmt.Errorf("last block hash validation mismatch: want: %x, have: %x", t.json.BestBlock, cmlast)