mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-29 18:40:34 +00:00
fix dump_consensus_state error'ing when height=0
This commit is contained in:
@@ -56,6 +56,7 @@ type Validator struct {
|
||||
}
|
||||
|
||||
// Creates a new copy of the validator so we can mutate accum.
|
||||
// Panics if the validator is nil.
|
||||
func (v *Validator) Copy() *Validator {
|
||||
vCopy := *v
|
||||
return &vCopy
|
||||
@@ -83,6 +84,9 @@ func (v *Validator) CompareAccum(other *Validator) *Validator {
|
||||
}
|
||||
|
||||
func (v *Validator) String() string {
|
||||
if v == nil {
|
||||
return "nil-Validator"
|
||||
}
|
||||
return fmt.Sprintf("Validator{%X %v %v-%v-%v VP:%v A:%v}",
|
||||
v.Address,
|
||||
v.PubKey,
|
||||
|
||||
@@ -112,6 +112,9 @@ func (valSet *ValidatorSet) TotalVotingPower() int64 {
|
||||
}
|
||||
|
||||
func (valSet *ValidatorSet) Proposer() (proposer *Validator) {
|
||||
if len(valSet.Validators) == 0 {
|
||||
return nil
|
||||
}
|
||||
if valSet.proposer == nil {
|
||||
for _, val := range valSet.Validators {
|
||||
valSet.proposer = valSet.proposer.CompareAccum(val)
|
||||
@@ -255,6 +258,9 @@ func (valSet *ValidatorSet) String() string {
|
||||
}
|
||||
|
||||
func (valSet *ValidatorSet) StringIndented(indent string) string {
|
||||
if valSet == nil {
|
||||
return "nil-ValidatorSet"
|
||||
}
|
||||
valStrings := []string{}
|
||||
valSet.Iterate(func(index int, val *Validator) bool {
|
||||
valStrings = append(valStrings, val.String())
|
||||
|
||||
Reference in New Issue
Block a user