diff --git a/app/config.go b/app/config.go deleted file mode 100644 index c6cd322e3b..0000000000 --- a/app/config.go +++ /dev/null @@ -1,13 +0,0 @@ -package app - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - -func init() { - cfg := sdk.GetConfig() - cfg.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) - cfg.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) - cfg.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) - cfg.Seal() -} diff --git a/app/sdk_config.go b/app/sdk_config.go new file mode 100644 index 0000000000..dd74de158d --- /dev/null +++ b/app/sdk_config.go @@ -0,0 +1,15 @@ +package app + +import sdk "github.com/cosmos/cosmos-sdk/types" + +func init() { + setCosmosSDKConfig() +} + +func setCosmosSDKConfig() { + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(Bech32PrefixAccAddr, Bech32PrefixAccPub) + config.SetBech32PrefixForValidator(Bech32PrefixValAddr, Bech32PrefixValPub) + config.SetBech32PrefixForConsensusNode(Bech32PrefixConsAddr, Bech32PrefixConsPub) + config.Seal() +} diff --git a/app/sdk_config_test.go b/app/sdk_config_test.go new file mode 100644 index 0000000000..f3179096df --- /dev/null +++ b/app/sdk_config_test.go @@ -0,0 +1,18 @@ +package app + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/assert" +) + +func Test_setCosmosSDKConfig(t *testing.T) { + config := sdk.GetConfig() + assert.Equal(t, Bech32PrefixAccAddr, config.GetBech32AccountAddrPrefix()) + assert.Equal(t, Bech32PrefixAccPub, config.GetBech32AccountPubPrefix()) + assert.Equal(t, Bech32PrefixValAddr, config.GetBech32ValidatorAddrPrefix()) + assert.Equal(t, Bech32PrefixValPub, config.GetBech32ValidatorPubPrefix()) + assert.Equal(t, Bech32PrefixConsAddr, config.GetBech32ConsensusAddrPrefix()) + assert.Equal(t, Bech32PrefixConsPub, config.GetBech32ConsensusPubPrefix()) +} diff --git a/cmd/celestia-appd/cmd/root.go b/cmd/celestia-appd/cmd/root.go index 6d4663a4d7..38b23a943d 100644 --- a/cmd/celestia-appd/cmd/root.go +++ b/cmd/celestia-appd/cmd/root.go @@ -121,9 +121,6 @@ func setDefaultConsensusParams(command *cobra.Command) error { } func initRootCmd(rootCmd *cobra.Command, encodingConfig encoding.Config) { - cfg := sdk.GetConfig() - cfg.Seal() - rootCmd.AddCommand( genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),