Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,15 @@ func testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra
ctx.Viper.Set(KeyUserPubKey, userPubKey)
testnetApp := testnetAppCreator(ctx.Logger, db, traceWriter, ctx.Viper)

var success bool
defer func() {
if !success {
if err := testnetApp.Close(); err != nil {
ctx.Logger.Error("failed to close testnet app on error", "err", err)
}
}
}()

// We need to create a temporary proxyApp to get the initial state of the application.
// Depending on how the node was stopped, the application height can differ from the blockStore height.
// This height difference changes how we go about modifying the state.
Expand Down Expand Up @@ -975,7 +984,8 @@ func testnetify(ctx *Context, testnetAppCreator types.AppCreator, db dbm.DB, tra
return nil, err
}

return testnetApp, err
success = true
return testnetApp, nil
}

// addStartNodeFlags should be added to any CLI commands that start the network.
Expand Down
Loading