Skip to content

Commit

Permalink
Mege PR #5092: changed bench32prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elvin-du authored and alexanderbez committed Nov 6, 2019
1 parent 60c4f5c commit 5a310fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ that allows for arbitrary vesting periods.

### Improvements

* (keys) [\#5091](https://github.com/cosmos/cosmos-sdk/issues/5091) Changed prefixes using `SetBech32PrefixForAccount(), SetBech32PrefixForValidator(), SetBech32PrefixForConsensusNode()` methods are respected in `keys parse`.
* (server) [\#4215](https://github.com/cosmos/cosmos-sdk/issues/4215) The `--pruning` flag
has been moved to the configuration file, to allow easier node configuration.
* (cli) [\#5116](https://github.com/cosmos/cosmos-sdk/issues/5116) The `CLIContext` now supports multiple verifiers
Expand All @@ -149,7 +150,6 @@ chain ID and node URI or client set. To use a `CLIContext` with a verifier for a
context.CreateVerifier(sideCtx, context.DefaultVerifierCacheSize),
)
```

* (modules) [\#5017](https://github.com/cosmos/cosmos-sdk/pull/5017) The `x/auth` package now supports
generalized genesis accounts through the `GenesisAccount` interface.
* (modules) [\#4762](https://github.com/cosmos/cosmos-sdk/issues/4762) Deprecate remove and add permissions in ModuleAccount.
Expand Down
20 changes: 12 additions & 8 deletions client/keys/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

var config = sdk.GetConfig()
var bech32Prefixes = []string{
config.GetBech32AccountAddrPrefix(),
config.GetBech32AccountPubPrefix(),
config.GetBech32ValidatorAddrPrefix(),
config.GetBech32ValidatorPubPrefix(),
config.GetBech32ConsensusAddrPrefix(),
config.GetBech32ConsensusPubPrefix(),
func bech32Prefixes() []string {
config := sdk.GetConfig()

return []string{
config.GetBech32AccountAddrPrefix(),
config.GetBech32AccountPubPrefix(),
config.GetBech32ValidatorAddrPrefix(),
config.GetBech32ValidatorPubPrefix(),
config.GetBech32ConsensusAddrPrefix(),
config.GetBech32ConsensusPubPrefix(),
}
}

type hexOutput struct {
Expand All @@ -45,6 +48,7 @@ type bech32Output struct {
}

func newBech32Output(bs []byte) bech32Output {
bech32Prefixes := bech32Prefixes()
out := bech32Output{Formats: make([]string, len(bech32Prefixes))}
for i, prefix := range bech32Prefixes {
bech32Addr, err := bech32.ConvertAndEncode(prefix, bs)
Expand Down

0 comments on commit 5a310fa

Please sign in to comment.