types: allow genesis file to have 0 validators (#2148)

* fixing issue 2015

* Remove comments for code review

* Update tests
This commit is contained in:
b00f
2018-08-14 23:02:53 +08:00
committed by Anton Kaliaev
parent 89668c3179
commit 0f931eeb10
3 changed files with 24 additions and 14 deletions

View File

@ -25,7 +25,7 @@ type GenesisDoc struct {
GenesisTime time.Time `json:"genesis_time"`
ChainID string `json:"chain_id"`
ConsensusParams *ConsensusParams `json:"consensus_params,omitempty"`
Validators []GenesisValidator `json:"validators"`
Validators []GenesisValidator `json:"validators,omitempty"`
AppHash cmn.HexBytes `json:"app_hash"`
AppState json.RawMessage `json:"app_state,omitempty"`
}
@ -65,10 +65,6 @@ func (genDoc *GenesisDoc) ValidateAndComplete() error {
}
}
if len(genDoc.Validators) == 0 {
return cmn.NewError("The genesis file must have at least one validator")
}
for _, v := range genDoc.Validators {
if v.Power == 0 {
return cmn.NewError("The genesis file cannot contain validators with no voting power: %v", v)