Skip to content

Commit

Permalink
add blockchain.Stop as defer to test (#714)
Browse files Browse the repository at this point in the history
Co-authered-by: najeal <[email protected]>
Co-authored-by: Ceyhun Onur <[email protected]>
  • Loading branch information
najeal and ceyonur authored Jul 3, 2023
1 parent 9abfac7 commit 75c3486
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/test_blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"fmt"
"math/big"
"strings"
"sync"
"testing"

"github.com/ava-labs/subnet-evm/commontype"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 75c3486

Please sign in to comment.