diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-08-07 20:47:25 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-08-07 21:00:47 +0800 |
commit | 2b50367fe938e603a5f9d3a525e0cdfa000f402e (patch) | |
tree | c032258a82131d9d3bacbe309682249c2430d6c9 /core/block_validator_test.go | |
parent | 46cf0a616b597dfb8b1feff80ad58b6eb81e57d5 (diff) | |
download | go-tangerine-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar go-tangerine-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.gz go-tangerine-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.bz2 go-tangerine-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.lz go-tangerine-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.xz go-tangerine-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.zst go-tangerine-2b50367fe938e603a5f9d3a525e0cdfa000f402e.zip |
core: fix blockchain goroutine leaks in tests
Diffstat (limited to 'core/block_validator_test.go')
-rw-r--r-- | core/block_validator_test.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/block_validator_test.go b/core/block_validator_test.go index abe1766b4..c0afc2955 100644 --- a/core/block_validator_test.go +++ b/core/block_validator_test.go @@ -44,6 +44,7 @@ func TestHeaderVerification(t *testing.T) { } // Run the header checker for blocks one-by-one, checking for both valid and invalid nonces chain, _ := NewBlockChain(testdb, params.TestChainConfig, ethash.NewFaker(), new(event.TypeMux), vm.Config{}) + defer chain.Stop() for i := 0; i < len(blocks); i++ { for j, valid := range []bool{true, false} { @@ -108,9 +109,11 @@ func testHeaderConcurrentVerification(t *testing.T, threads int) { if valid { chain, _ := NewBlockChain(testdb, params.TestChainConfig, ethash.NewFaker(), new(event.TypeMux), vm.Config{}) _, results = chain.engine.VerifyHeaders(chain, headers, seals) + chain.Stop() } else { chain, _ := NewBlockChain(testdb, params.TestChainConfig, ethash.NewFakeFailer(uint64(len(headers)-1)), new(event.TypeMux), vm.Config{}) _, results = chain.engine.VerifyHeaders(chain, headers, seals) + chain.Stop() } // Wait for all the verification results checks := make(map[int]error) @@ -172,6 +175,8 @@ func testHeaderConcurrentAbortion(t *testing.T, threads int) { // Start the verifications and immediately abort chain, _ := NewBlockChain(testdb, params.TestChainConfig, ethash.NewFakeDelayer(time.Millisecond), new(event.TypeMux), vm.Config{}) + defer chain.Stop() + abort, results := chain.engine.VerifyHeaders(chain, headers, seals) close(abort) |