Add ResultHash to header

This commit is contained in:
Ethan Frey
2017-12-22 16:43:45 +01:00
committed by Ethan Buchman
parent 632cc918b4
commit 58c5df729b
12 changed files with 44 additions and 21 deletions

View File

@ -241,6 +241,7 @@ func (s *State) MakeBlock(height int64, txs []types.Tx, commit *types.Commit) (*
block.ValidatorsHash = s.Validators.Hash()
block.AppHash = s.AppHash
block.ConsensusHash = s.LastConsensusParams.Hash()
block.ResultsHash = s.LastResultHash
return block, block.MakePartSet(s.ConsensusParams.BlockGossip.BlockPartSizeBytes)
}
@ -279,6 +280,9 @@ func (s *State) validateBlock(b *types.Block) error {
if !bytes.Equal(b.ConsensusHash, s.LastConsensusParams.Hash()) {
return fmt.Errorf("Wrong Block.Header.ConsensusHash. Expected %X, got %v", s.LastConsensusParams.Hash(), b.ConsensusHash)
}
if !bytes.Equal(b.ResultsHash, s.LastResultHash) {
return fmt.Errorf("Wrong Block.Header.ResultsHash. Expected %X, got %v", s.LastResultHash, b.ResultsHash)
}
// Validate block LastCommit.
if b.Height == 1 {