mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-25 10:41:41 +00:00
rpc: separate out golang API into rpc/core
This commit is contained in:
26
rpc/core/validators.go
Normal file
26
rpc/core/validators.go
Normal file
@ -0,0 +1,26 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
sm "github.com/tendermint/tendermint/state"
|
||||
)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
func ListValidators() (uint, []*sm.Validator, []*sm.Validator) {
|
||||
var blockHeight uint
|
||||
var bondedValidators []*sm.Validator
|
||||
var unbondingValidators []*sm.Validator
|
||||
|
||||
state := consensusState.GetState()
|
||||
blockHeight = state.LastBlockHeight
|
||||
state.BondedValidators.Iterate(func(index uint, val *sm.Validator) bool {
|
||||
bondedValidators = append(bondedValidators, val)
|
||||
return false
|
||||
})
|
||||
state.UnbondingValidators.Iterate(func(index uint, val *sm.Validator) bool {
|
||||
unbondingValidators = append(unbondingValidators, val)
|
||||
return false
|
||||
})
|
||||
|
||||
return blockHeight, bondedValidators, unbondingValidators
|
||||
}
|
Reference in New Issue
Block a user