// Returns a hash that represents the state data, excluding Last* func (s *State) Hash() []byte { return merkle.SimpleHashFromMap(map[string]interface{}{ "BondedValidators": s.BondedValidators, "UnbondingValidators": s.UnbondingValidators, "Accounts": s.accounts, "ValidatorInfos": s.validatorInfos, "NameRegistry": s.nameReg, }) }
// NOTE: hash is nil if required fields are missing. func (h *Header) Hash() []byte { if len(h.StateHash) == 0 { return nil } return merkle.SimpleHashFromMap(map[string]interface{}{ "ChainID": h.ChainID, "Height": h.Height, "Time": h.Time, "Fees": h.Fees, "NumTxs": h.NumTxs, "LastBlock": h.LastBlockHash, "LastBlockParts": h.LastBlockParts, "LastValidation": h.LastValidationHash, "Data": h.DataHash, "State": h.StateHash, }) }