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. // GetAllValidatorAddresses returns all validator addresses.
func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]common.Address, error) { func (s *PublicBlockChainAPI) GetAllValidatorAddresses() ([]string, error) {
return s.b.GetAllValidatorAddresses(), nil addresses := []string{}
for _, addr := range s.b.GetAllValidatorAddresses() {
addresses = append(addresses, address2.ToBech32(addr))
}
return addresses, nil
} }
// GetActiveValidatorAddresses returns active validator addresses. // GetActiveValidatorAddresses returns active validator addresses.
func (s *PublicBlockChainAPI) GetActiveValidatorAddresses() ([]common.Address, error) { func (s *PublicBlockChainAPI) GetActiveValidatorAddresses() ([]string, error) {
return s.b.GetActiveValidatorAddresses(), nil addresses := []string{}
for _, addr := range s.b.GetActiveValidatorAddresses() {
addresses = append(addresses, address2.ToBech32(addr))
}
return addresses, nil
} }
// GetValidatorInformation returns information about a validator. // GetValidatorInformation returns information about a validator.

Loading…
Cancel
Save