Browse Source

Calculate validator hash from genesis doc

pull/561/head
Ethan Frey 8 years ago
parent
commit
e4caf96bcb
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      types/genesis.go

+ 9
- 0
types/genesis.go 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


Loading…
Cancel
Save