storage: close function

add close function to storage interface
add common defer function call which will close db connection
remove context as soon as it's not needed anymore
updated unit tests
This commit is contained in:
Vsevolod Brekelov 2019-09-16 18:52:47 +03:00
parent b21a220712
commit 264dfef370
11 changed files with 42 additions and 27 deletions

View file

@ -112,7 +112,7 @@ Main:
// initBlockChain initializes BlockChain with preselected DB.
func initBlockChain(context context.Context, cfg config.Config) (*core.Blockchain, error) {
store, err := storage.NewStore(context, cfg.ApplicationConfiguration.DBConfiguration)
store, err := storage.NewStore(cfg.ApplicationConfiguration.DBConfiguration)
if err != nil {
return nil, cli.NewExitError(fmt.Errorf("could not initialize storage: %s", err), 1)
}