fix validator list addr format

pull/1951/head
Rongjian Lan 5 years ago
parent fd43690f41
commit bd79d2abd7
  1. 16
      internal/hmyapi/blockchain.go

@ -494,13 +494,21 @@ func (s *PublicBlockChainAPI) LatestHeader(ctx context.Context) *HeaderInformati
}
// GetAllValidatorAddresses returns all validator addresses.
func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]common.Address, error) {
return s.b.GetAllValidatorAddresses(), nil
func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]string, error) {
addresses := []string{}
for _, addr := range s.b.GetAllValidatorAddresses() {
addresses = append(addresses, address2.ToBech32(addr))
}
return addresses, nil
}
// GetActiveValidatorAddresses returns active validator addresses.
func (s *PublicBlockChainAPI) GetActiveValidatorAddresses() ([]common.Address, error) {
return s.b.GetActiveValidatorAddresses(), nil
func (s *PublicBlockChainAPI) GetActiveValidatorAddresses() ([]string, error) {
addresses := []string{}
for _, addr := range s.b.GetActiveValidatorAddresses() {
addresses = append(addresses, address2.ToBech32(addr))
}
return addresses, nil
}
// GetValidatorInformation returns information about a validator.

Loading…
Cancel
Save