mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-12 12:51:22 +00:00
rpc: Block and Commit take pointers; return latest on nil
This commit is contained in:
@ -42,17 +42,19 @@ import (
|
||||
// "jsonrpc": "2.0"
|
||||
// }
|
||||
// ```
|
||||
func Validators(height *int) (*ctypes.ResultValidators, error) {
|
||||
if height == nil {
|
||||
func Validators(heightPtr *int) (*ctypes.ResultValidators, error) {
|
||||
if heightPtr == nil {
|
||||
blockHeight, validators := consensusState.GetValidators()
|
||||
return &ctypes.ResultValidators{blockHeight, validators}, nil
|
||||
}
|
||||
|
||||
height := *heightPtr
|
||||
state := consensusState.GetState()
|
||||
validators, err := state.LoadValidators(*height)
|
||||
validators, err := state.LoadValidators(height)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ctypes.ResultValidators{*height, validators.Validators}, nil
|
||||
return &ctypes.ResultValidators{height, validators.Validators}, nil
|
||||
}
|
||||
|
||||
// Dump consensus state.
|
||||
|
Reference in New Issue
Block a user