From 4fc5038cc65292212b3a897dc973c19ec06f574d Mon Sep 17 00:00:00 2001 From: Adam Tucker Date: Mon, 29 Jan 2024 11:20:30 -0700 Subject: [PATCH] remove redundancy --- server/start.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/server/start.go b/server/start.go index d894f75e0ee8..6defcb66edd7 100644 --- a/server/start.go +++ b/server/start.go @@ -6,6 +6,7 @@ import ( "bufio" "errors" "fmt" + "io" "net" "net/http" "os" @@ -280,7 +281,7 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App var app types.Application if isTestnet, ok := ctx.Viper.Get(KeyIsTestnet).(bool); ok && isTestnet { - app, err = testnetify(ctx, home, appCreator, db) + app, err = testnetify(ctx, home, appCreator, db, traceWriter) if err != nil { return err } @@ -669,7 +670,7 @@ before stopping the daemon. // testnetify modifies both state and blockStore, allowing the provided operator address and local validator key to control the network // that the state in the data folder represents. The chainID of the local genesis file is modified to match the provided chainID. -func testnetify(ctx *Context, home string, testnetAppCreator types.AppCreator, db db.DB) (types.Application, error) { +func testnetify(ctx *Context, home string, testnetAppCreator types.AppCreator, db db.DB, traceWriter io.WriteCloser) (types.Application, error) { config := ctx.Config newChainID, ok := ctx.Viper.Get(KeyNewChainID).(string) @@ -677,12 +678,6 @@ func testnetify(ctx *Context, home string, testnetAppCreator types.AppCreator, d return nil, fmt.Errorf("expected string for key %s", KeyNewChainID) } - traceWriterFile := ctx.Viper.GetString(flagTraceStore) - traceWriter, err := openTraceWriter(traceWriterFile) - if err != nil { - return nil, err - } - genDocProvider := node.DefaultGenesisDocProviderFunc(config) // Initialize blockStore and stateDB.