Merge pull request #2255 from flicker-harmony/pr_all_validators_info

All validator info
pull/2256/head
Minh Doan 5 years ago committed by GitHub
commit 9b3bad3c70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      internal/hmyapi/apiv1/blockchain.go
  2. 10
      internal/hmyapi/apiv2/blockchain.go

@ -553,6 +553,16 @@ func (s *PublicBlockChainAPI) GetValidatorInformation(ctx context.Context, addre
return validator, nil
}
// GetAllValidatorInformation returns information about all validators.
func (s *PublicBlockChainAPI) GetAllValidatorInformation(ctx context.Context) []*staking.Validator {
addresses := s.b.GetAllValidatorAddresses()
validators := make([]*staking.Validator, len(addresses))
for i, address := range addresses {
validators[i] = s.b.GetValidatorInformation(address)
}
return validators
}
// GetDelegationsByDelegator returns list of delegations for a delegator address.
func (s *PublicBlockChainAPI) GetDelegationsByDelegator(ctx context.Context, address string) ([]*RPCDelegation, error) {
delegatorAddress := internal_common.ParseAddr(address)

@ -518,6 +518,16 @@ func (s *PublicBlockChainAPI) GetValidatorInformation(ctx context.Context, addre
return validator, nil
}
// GetAllValidatorInformation returns information about all validators.
func (s *PublicBlockChainAPI) GetAllValidatorInformation(ctx context.Context) []*staking.Validator {
addresses := s.b.GetAllValidatorAddresses()
validators := make([]*staking.Validator, len(addresses))
for i, address := range addresses {
validators[i] = s.b.GetValidatorInformation(address)
}
return validators
}
// GetDelegationsByDelegator returns list of delegations for a delegator address.
func (s *PublicBlockChainAPI) GetDelegationsByDelegator(ctx context.Context, address string) ([]*RPCDelegation, error) {
delegatorAddress := internal_common.ParseAddr(address)

Loading…
Cancel
Save