chainregistry: only stop ChainService after successful start

This commit is contained in:
Johan T. Halseth 2019-04-08 12:46:50 +02:00
parent 1fea5b09b2
commit 9e67f25957
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -730,14 +730,15 @@ func initNeutrinoBackend(chainDir string) (*neutrino.ChainService, func(), error
"client: %v", err)
}
if err := neutrinoCS.Start(); err != nil {
db.Close()
return nil, nil, err
}
cleanUp := func() {
db.Close()
neutrinoCS.Stop()
}
if err := neutrinoCS.Start(); err != nil {
cleanUp()
return nil, nil, err
}
return neutrinoCS, cleanUp, nil
}