aboutsummaryrefslogtreecommitdiffstats
path: root/core/dao_test.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-08-07 20:47:25 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-08-07 21:00:47 +0800
commit2b50367fe938e603a5f9d3a525e0cdfa000f402e (patch)
treec032258a82131d9d3bacbe309682249c2430d6c9 /core/dao_test.go
parent46cf0a616b597dfb8b1feff80ad58b6eb81e57d5 (diff)
downloaddexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.gz
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.bz2
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.lz
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.xz
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.tar.zst
dexon-2b50367fe938e603a5f9d3a525e0cdfa000f402e.zip
core: fix blockchain goroutine leaks in tests
Diffstat (limited to 'core/dao_test.go')
-rw-r--r--core/dao_test.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/dao_test.go b/core/dao_test.go
index bc9f3f394..99bf1ecae 100644
--- a/core/dao_test.go
+++ b/core/dao_test.go
@@ -43,11 +43,13 @@ func TestDAOForkRangeExtradata(t *testing.T) {
gspec.MustCommit(proDb)
proConf := &params.ChainConfig{HomesteadBlock: big.NewInt(0), DAOForkBlock: forkBlock, DAOForkSupport: true}
proBc, _ := NewBlockChain(proDb, proConf, ethash.NewFaker(), new(event.TypeMux), vm.Config{})
+ defer proBc.Stop()
conDb, _ := ethdb.NewMemDatabase()
gspec.MustCommit(conDb)
conConf := &params.ChainConfig{HomesteadBlock: big.NewInt(0), DAOForkBlock: forkBlock, DAOForkSupport: false}
conBc, _ := NewBlockChain(conDb, conConf, ethash.NewFaker(), new(event.TypeMux), vm.Config{})
+ defer conBc.Stop()
if _, err := proBc.InsertChain(prefix); err != nil {
t.Fatalf("pro-fork: failed to import chain prefix: %v", err)
@@ -60,7 +62,9 @@ func TestDAOForkRangeExtradata(t *testing.T) {
// Create a pro-fork block, and try to feed into the no-fork chain
db, _ = ethdb.NewMemDatabase()
gspec.MustCommit(db)
+
bc, _ := NewBlockChain(db, conConf, ethash.NewFaker(), new(event.TypeMux), vm.Config{})
+ defer bc.Stop()
blocks := conBc.GetBlocksFromHash(conBc.CurrentBlock().Hash(), int(conBc.CurrentBlock().NumberU64()))
for j := 0; j < len(blocks)/2; j++ {
@@ -81,7 +85,9 @@ func TestDAOForkRangeExtradata(t *testing.T) {
// Create a no-fork block, and try to feed into the pro-fork chain
db, _ = ethdb.NewMemDatabase()
gspec.MustCommit(db)
+
bc, _ = NewBlockChain(db, proConf, ethash.NewFaker(), new(event.TypeMux), vm.Config{})
+ defer bc.Stop()
blocks = proBc.GetBlocksFromHash(proBc.CurrentBlock().Hash(), int(proBc.CurrentBlock().NumberU64()))
for j := 0; j < len(blocks)/2; j++ {
@@ -103,7 +109,9 @@ func TestDAOForkRangeExtradata(t *testing.T) {
// Verify that contra-forkers accept pro-fork extra-datas after forking finishes
db, _ = ethdb.NewMemDatabase()
gspec.MustCommit(db)
+
bc, _ := NewBlockChain(db, conConf, ethash.NewFaker(), new(event.TypeMux), vm.Config{})
+ defer bc.Stop()
blocks := conBc.GetBlocksFromHash(conBc.CurrentBlock().Hash(), int(conBc.CurrentBlock().NumberU64()))
for j := 0; j < len(blocks)/2; j++ {
@@ -119,7 +127,9 @@ func TestDAOForkRangeExtradata(t *testing.T) {
// Verify that pro-forkers accept contra-fork extra-datas after forking finishes
db, _ = ethdb.NewMemDatabase()
gspec.MustCommit(db)
+
bc, _ = NewBlockChain(db, proConf, ethash.NewFaker(), new(event.TypeMux), vm.Config{})
+ defer bc.Stop()
blocks = proBc.GetBlocksFromHash(proBc.CurrentBlock().Hash(), int(proBc.CurrentBlock().NumberU64()))
for j := 0; j < len(blocks)/2; j++ {