Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dot): Closes db if node initialized check fails #1551

14 changes: 8 additions & 6 deletions dot/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ func NodeInitialized(basepath string, expected bool) bool {
return false
}

defer func() {
// close database
err = db.Close()
if err != nil {
logger.Error("failed to close database", "error", err)
}
}()

// load genesis data from initialised node database
_, err = state.NewBaseState(db).LoadGenesisData()
if err != nil {
Expand All @@ -158,12 +166,6 @@ func NodeInitialized(basepath string, expected bool) bool {
return false
}

// close database
err = db.Close()
if err != nil {
logger.Error("failed to close database", "error", err)
}

return true
}

Expand Down