Blockchain graceful shutdown (#139)

* Blockchain graceful shutdown

- fix #138
- stop blockchain goroutine
- close leveldb database

* fix possible context leak (go vet)
This commit is contained in:
Evgeniy Kulikov 2019-02-19 14:48:48 +03:00 committed by fabwa
parent c0a5c100ca
commit 9c24bf9139
5 changed files with 53 additions and 19 deletions

View file

@ -2,6 +2,7 @@ package rpc
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"net/http"
@ -25,7 +26,7 @@ func TestHandler(t *testing.T) {
t.Fatal("could not create levelDB chain", err)
}
chain, err := core.NewBlockchainLevelDB(cfg)
chain, err := core.NewBlockchainLevelDB(context.Background(), cfg)
if err != nil {
t.Fatal("could not create levelDB chain", err)
}