Calculate validator hash from genesis doc

This commit is contained in:
Ethan Frey 2017-06-26 17:06:49 +02:00
parent 10982f4d8f
commit e4caf96bcb
1 changed files with 9 additions and 0 deletions

View File

@ -39,6 +39,15 @@ func (genDoc *GenesisDoc) SaveAs(file string) error {
return cmn.WriteFile(file, genDocBytes, 0644)
}
func (genDoc *GenesisDoc) ValidatorHash() []byte {
vals := make([]*Validator, len(genDoc.Validators))
for i, v := range genDoc.Validators {
vals[i] = NewValidator(v.PubKey, v.Amount)
}
vset := NewValidatorSet(vals)
return vset.Hash()
}
//------------------------------------------------------------
// Make genesis state from file