diff --git a/core/test_blockchain.go b/core/test_blockchain.go index 83bab5a9fd..0eb98fb965 100644 --- a/core/test_blockchain.go +++ b/core/test_blockchain.go @@ -7,6 +7,7 @@ import ( "fmt" "math/big" "strings" + "sync" "testing" "github.com/ava-labs/subnet-evm/commontype" @@ -1187,6 +1188,8 @@ func TestReprocessAcceptBlockIdenticalStateRoot(t *testing.T, create func(db eth if err != nil { t.Fatal(err) } + var stopOnce sync.Once + defer stopOnce.Do(blockchain.Stop) signer := types.HomesteadSigner{} // Generate chain of blocks using [genDB] instead of [chainDB] to avoid writing @@ -1238,7 +1241,7 @@ func TestReprocessAcceptBlockIdenticalStateRoot(t *testing.T, create func(db eth t.Fatalf("Expected current block to be %s:%d, but found %s%d", expectedCurrentBlock.Hash().Hex(), expectedCurrentBlock.NumberU64(), currentBlock.Hash().Hex(), currentBlock.NumberU64()) } - blockchain.Stop() + stopOnce.Do(blockchain.Stop) blockchain, err = create(chainDB, gspec.Config, common.Hash{}) if err != nil {