rpc: getHeight helper function

This commit is contained in:
Ethan Buchman
2017-12-26 19:37:42 -05:00
parent 4171bd3bae
commit 801e3dfacf
2 changed files with 29 additions and 44 deletions

View File

@@ -43,12 +43,11 @@ import (
// }
// ```
func Validators(heightPtr *int64) (*ctypes.ResultValidators, error) {
if heightPtr == nil {
blockHeight, validators := consensusState.GetValidators()
return &ctypes.ResultValidators{blockHeight, validators}, nil
height, _, err := getHeight(blockStore, heightPtr)
if err != nil {
return nil, err
}
height := *heightPtr
state := consensusState.GetState()
validators, err := state.LoadValidators(height)
if err != nil {