Skip to content

Commit

Permalink
remove redundancy
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Jan 29, 2024
1 parent 3305767 commit 4fc5038
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"bufio"
"errors"
"fmt"
"io"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -669,20 +670,14 @@ 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)
if !ok {
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.
Expand Down

0 comments on commit 4fc5038

Please sign in to comment.