|
|
@ -258,8 +258,10 @@ func MaxDataBytesUnknownEvidence(maxBytes int64, valsCount int) int64 { |
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Header defines the structure of a Tendermint block header
|
|
|
|
// NOTE: changes to the Header should be duplicated in the abci Header
|
|
|
|
// and in /docs/spec/blockchain/blockchain.md
|
|
|
|
// NOTE: changes to the Header should be duplicated in:
|
|
|
|
// - header.Hash()
|
|
|
|
// - abci.Header
|
|
|
|
// - /docs/spec/blockchain/blockchain.md
|
|
|
|
type Header struct { |
|
|
|
// basic block info
|
|
|
|
Version version.Consensus `json:"version"` |
|
|
@ -289,6 +291,8 @@ type Header struct { |
|
|
|
} |
|
|
|
|
|
|
|
// Hash returns the hash of the header.
|
|
|
|
// It computes a Merkle tree from the header fields
|
|
|
|
// ordered as they appear in the Header.
|
|
|
|
// Returns nil if ValidatorHash is missing,
|
|
|
|
// since a Header is not valid unless there is
|
|
|
|
// a ValidatorsHash (corresponding to the validator set).
|
|
|
@ -296,23 +300,23 @@ func (h *Header) Hash() cmn.HexBytes { |
|
|
|
if h == nil || len(h.ValidatorsHash) == 0 { |
|
|
|
return nil |
|
|
|
} |
|
|
|
return merkle.SimpleHashFromMap(map[string][]byte{ |
|
|
|
"Version": cdcEncode(h.Version), |
|
|
|
"ChainID": cdcEncode(h.ChainID), |
|
|
|
"Height": cdcEncode(h.Height), |
|
|
|
"Time": cdcEncode(h.Time), |
|
|
|
"NumTxs": cdcEncode(h.NumTxs), |
|
|
|
"TotalTxs": cdcEncode(h.TotalTxs), |
|
|
|
"LastBlockID": cdcEncode(h.LastBlockID), |
|
|
|
"LastCommitHash": cdcEncode(h.LastCommitHash), |
|
|
|
"DataHash": cdcEncode(h.DataHash), |
|
|
|
"ValidatorsHash": cdcEncode(h.ValidatorsHash), |
|
|
|
"NextValidatorsHash": cdcEncode(h.NextValidatorsHash), |
|
|
|
"AppHash": cdcEncode(h.AppHash), |
|
|
|
"ConsensusHash": cdcEncode(h.ConsensusHash), |
|
|
|
"LastResultsHash": cdcEncode(h.LastResultsHash), |
|
|
|
"EvidenceHash": cdcEncode(h.EvidenceHash), |
|
|
|
"ProposerAddress": cdcEncode(h.ProposerAddress), |
|
|
|
return merkle.SimpleHashFromByteSlices([][]byte{ |
|
|
|
cdcEncode(h.Version), |
|
|
|
cdcEncode(h.ChainID), |
|
|
|
cdcEncode(h.Height), |
|
|
|
cdcEncode(h.Time), |
|
|
|
cdcEncode(h.NumTxs), |
|
|
|
cdcEncode(h.TotalTxs), |
|
|
|
cdcEncode(h.LastBlockID), |
|
|
|
cdcEncode(h.LastCommitHash), |
|
|
|
cdcEncode(h.DataHash), |
|
|
|
cdcEncode(h.ValidatorsHash), |
|
|
|
cdcEncode(h.NextValidatorsHash), |
|
|
|
cdcEncode(h.ConsensusHash), |
|
|
|
cdcEncode(h.AppHash), |
|
|
|
cdcEncode(h.LastResultsHash), |
|
|
|
cdcEncode(h.EvidenceHash), |
|
|
|
cdcEncode(h.ProposerAddress), |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|