fix default account addr prefix (#472)
This commit is contained in:
parent
98610e4999
commit
b3c895d039
@ -24,4 +24,11 @@ func TestSetBech32Prefixes(t *testing.T) {
|
||||
require.Equal(t, Bech32PrefixValPub, config.GetBech32ValidatorPubPrefix())
|
||||
require.Equal(t, Bech32PrefixConsAddr, config.GetBech32ConsensusAddrPrefix())
|
||||
require.Equal(t, Bech32PrefixConsPub, config.GetBech32ConsensusPubPrefix())
|
||||
|
||||
require.Equal(t, sdk.GetConfig().GetBech32AccountAddrPrefix(), config.GetBech32AccountAddrPrefix())
|
||||
require.Equal(t, sdk.GetConfig().GetBech32AccountPubPrefix(), config.GetBech32AccountPubPrefix())
|
||||
require.Equal(t, sdk.GetConfig().GetBech32ValidatorAddrPrefix(), config.GetBech32ValidatorAddrPrefix())
|
||||
require.Equal(t, sdk.GetConfig().GetBech32ValidatorPubPrefix(), config.GetBech32ValidatorPubPrefix())
|
||||
require.Equal(t, sdk.GetConfig().GetBech32ConsensusAddrPrefix(), config.GetBech32ConsensusAddrPrefix())
|
||||
require.Equal(t, sdk.GetConfig().GetBech32ConsensusPubPrefix(), config.GetBech32ConsensusPubPrefix())
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func accountToHex(addr string) (string, error) {
|
||||
if strings.HasPrefix(addr, sdk.Bech32PrefixAccAddr) {
|
||||
if strings.HasPrefix(addr, sdk.GetConfig().GetBech32AccountAddrPrefix()) {
|
||||
// Check to see if address is Cosmos bech32 formatted
|
||||
toAddr, err := sdk.AccAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
@ -47,7 +47,7 @@ func formatKeyToHash(key string) string {
|
||||
}
|
||||
|
||||
func cosmosAddressFromArg(addr string) (sdk.AccAddress, error) {
|
||||
if strings.HasPrefix(addr, sdk.Bech32PrefixAccAddr) {
|
||||
if strings.HasPrefix(addr, sdk.GetConfig().GetBech32AccountAddrPrefix()) {
|
||||
// Check to see if address is Cosmos bech32 formatted
|
||||
toAddr, err := sdk.AccAddressFromBech32(addr)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user