Skip to content

Commit

Permalink
Add SetChainID, and temporarily disable address caching for tempApp. …
Browse files Browse the repository at this point in the history
…Set initial config as testnet that will be overwritten by start.
  • Loading branch information
Taztingo committed Apr 16, 2024
1 parent 96060e2 commit a258da6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/provenanced/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ func NewRootCmd(sealConfig bool) (*cobra.Command, params.EncodingConfig) {
}
defer os.RemoveAll(tempDir)

// These are added to prevent invalid address caching from tempApp.
sdk.SetAddrCacheEnabled(false)
defer sdk.SetAddrCacheEnabled(true)

// We initially set the config as testnet so commands that run before start work for testing such as gentx.
app.SetConfig(true, false)

tempApp := app.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, nil,
tempDir,
0,
Expand Down Expand Up @@ -366,6 +373,8 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)),
)

chainID := cast.ToString(appOpts.Get(flags.FlagChainID))

return app.New(
logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
Expand All @@ -382,6 +391,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
baseapp.SetIAVLCacheSize(getIAVLCacheSize(appOpts)),
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))),
baseapp.SetChainID(chainID),
)
}

Expand Down

0 comments on commit a258da6

Please sign in to comment.