chainregistry: properly close neutrino database upon errors

This commit is contained in:
Wilmer Paulino 2019-07-15 13:42:01 -07:00
parent e147445c08
commit 62d716d3c3
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -713,6 +713,7 @@ func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error
cfg.NeutrinoMode.AssertFilterHeader, cfg.NeutrinoMode.AssertFilterHeader,
) )
if err != nil { if err != nil {
db.Close()
return nil, nil, err return nil, nil, err
} }
@ -754,6 +755,7 @@ func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error
neutrinoCS, err := neutrino.NewChainService(config) neutrinoCS, err := neutrino.NewChainService(config)
if err != nil { if err != nil {
db.Close()
return nil, nil, fmt.Errorf("unable to create neutrino light "+ return nil, nil, fmt.Errorf("unable to create neutrino light "+
"client: %v", err) "client: %v", err)
} }