core: fix blockchain goroutine leaks in tests

This commit is contained in:
Péter Szilágyi
2017-08-07 15:47:25 +03:00
parent 46cf0a616b
commit 2b50367fe9
8 changed files with 79 additions and 23 deletions

View File

@ -81,7 +81,10 @@ func ExampleGenerateChain() {
// Import the chain. This runs all block validation rules.
evmux := &event.TypeMux{}
blockchain, _ := NewBlockChain(db, gspec.Config, ethash.NewFaker(), evmux, vm.Config{})
defer blockchain.Stop()
if i, err := blockchain.InsertChain(chain); err != nil {
fmt.Printf("insert error (block %d): %v\n", chain[i].NumberU64(), err)
return