Skip to content

Commit

Permalink
add chain ID to root
Browse files Browse the repository at this point in the history
  • Loading branch information
phamminh0811 committed Aug 3, 2023
1 parent 3af0d86 commit 82bae8c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions cmd/feeappd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/cometbft/cometbft/libs/log"

dbm "github.com/cometbft/cometbft-db"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/config"
Expand Down Expand Up @@ -244,6 +245,17 @@ func (ac appCreator) newApp(
wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer))
}

homeDir := cast.ToString(appOpts.Get(flags.FlagHome))
chainID := cast.ToString(appOpts.Get(flags.FlagChainID))
if chainID == "" {
// fallback to genesis chain-id
appGenesis, err := tmtypes.GenesisDocFromFile(filepath.Join(homeDir, "config", "genesis.json"))
if err != nil {
panic(err)
}

chainID = appGenesis.ChainID
}
return feeapp.NewFeeAbs(
logger, db, traceStore, true, skipUpgradeHeights,
cast.ToString(appOpts.Get(flags.FlagHome)),
Expand All @@ -263,6 +275,7 @@ func (ac appCreator) newApp(
Interval: cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)),
KeepRecent: cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)),
}),
baseapp.SetChainID(chainID),
)
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require (
cosmossdk.io/api v0.3.1 // indirect
cosmossdk.io/core v0.5.1 // indirect
cosmossdk.io/depinject v1.0.0-alpha.3 // indirect
cosmossdk.io/math v1.0.0-rc.0 // indirect
cosmossdk.io/math v1.0.0-rc.0
cosmossdk.io/tools/rosetta v0.2.1 // indirect
filippo.io/edwards25519 v1.0.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
Expand Down
Empty file modified testnode.sh
100644 → 100755
Empty file.

0 comments on commit 82bae8c

Please sign in to comment.