tests: fix nil deref

This commit is contained in:
Martin Holst Swende 2023-11-10 10:49:25 +01:00
parent bebe04b56b
commit 9191e97ca3
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -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)