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

@ -110,7 +110,7 @@ func makeVote(header *types.Header, vals *types.ValidatorSet, key crypto.PrivKey
// Silences warning that vals can also be merkle.Hashable
// nolint: interfacer
func genHeader(chainID string, height int64, txs types.Txs,
vals *types.ValidatorSet, appHash, consHash []byte) *types.Header {
vals *types.ValidatorSet, appHash, consHash, resHash []byte) *types.Header {
return &types.Header{
ChainID: chainID,
@ -124,14 +124,15 @@ func genHeader(chainID string, height int64, txs types.Txs,
DataHash: txs.Hash(),
AppHash: appHash,
ConsensusHash: consHash,
ResultsHash: resHash,
}
}
// GenCommit calls genHeader and signHeader and combines them into a Commit.
func (v ValKeys) GenCommit(chainID string, height int64, txs types.Txs,
vals *types.ValidatorSet, appHash, consHash []byte, first, last int) Commit {
vals *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) Commit {
header := genHeader(chainID, height, txs, vals, appHash, consHash)
header := genHeader(chainID, height, txs, vals, appHash, consHash, resHash)
check := Commit{
Header: header,
Commit: v.signHeader(header, first, last),
@ -141,9 +142,9 @@ func (v ValKeys) GenCommit(chainID string, height int64, txs types.Txs,
// GenFullCommit calls genHeader and signHeader and combines them into a Commit.
func (v ValKeys) GenFullCommit(chainID string, height int64, txs types.Txs,
vals *types.ValidatorSet, appHash, consHash []byte, first, last int) FullCommit {
vals *types.ValidatorSet, appHash, consHash, resHash []byte, first, last int) FullCommit {
header := genHeader(chainID, height, txs, vals, appHash, consHash)
header := genHeader(chainID, height, txs, vals, appHash, consHash, resHash)
commit := Commit{
Header: header,
Commit: v.signHeader(header, first, last),