Merge PR #3142: Basecoind BECH fixes
Adds a function to initialise the Cosmos SDK to use the same Bech32 prefixes as those which basecli uses.
This commit is contained in:
parent
d72e52b8f6
commit
332a5a34c5
@ -27,6 +27,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/docs/examples/basecoin/app"
|
||||
"github.com/cosmos/cosmos-sdk/server"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -51,6 +52,9 @@ func main() {
|
||||
rootDir := os.ExpandEnv("$HOME/.basecoind")
|
||||
executor := cli.PrepareBaseCmd(rootCmd, "BC", rootDir)
|
||||
|
||||
// initialise the Bech32 prefixes
|
||||
initSDKConfig()
|
||||
|
||||
err := executor.Execute()
|
||||
if err != nil {
|
||||
// Note: Handle with #870
|
||||
@ -58,6 +62,14 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func initSDKConfig() {
|
||||
config := sdk.GetConfig()
|
||||
config.SetBech32PrefixForAccount("baseacc", "basepub")
|
||||
config.SetBech32PrefixForValidator("baseval", "basevalpub")
|
||||
config.SetBech32PrefixForConsensusNode("basecons", "baseconspub")
|
||||
config.Seal()
|
||||
}
|
||||
|
||||
// get cmd to initialize all files for tendermint and application
|
||||
// nolint: errcheck
|
||||
func InitCmd(ctx *server.Context, cdc *codec.Codec) *cobra.Command {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user