call it LastResultsHash

This commit is contained in:
Ethan Buchman
2017-12-26 19:53:26 -05:00
parent 801e3dfacf
commit 028ee58580
7 changed files with 23 additions and 32 deletions
+6 -6
View File
@@ -150,10 +150,10 @@ type Header struct {
DataHash data.Bytes `json:"data_hash"` // transactions
// hashes from the app output from the prev block
ValidatorsHash data.Bytes `json:"validators_hash"` // validators for the current block
ConsensusHash data.Bytes `json:"consensus_hash"` // consensus params for current block
AppHash data.Bytes `json:"app_hash"` // state after txs from the previous block
ResultsHash data.Bytes `json:"results_hash"` // root hash of all results from the txs from the previous block
ValidatorsHash data.Bytes `json:"validators_hash"` // validators for the current block
ConsensusHash data.Bytes `json:"consensus_hash"` // consensus params for current block
AppHash data.Bytes `json:"app_hash"` // state after txs from the previous block
LastResultsHash data.Bytes `json:"last_results_hash"` // root hash of all results from the txs from the previous block
}
// Hash returns the hash of the header.
@@ -174,7 +174,7 @@ func (h *Header) Hash() data.Bytes {
"Validators": h.ValidatorsHash,
"App": h.AppHash,
"Consensus": h.ConsensusHash,
"Results": h.ResultsHash,
"Results": h.LastResultsHash,
})
}
@@ -208,7 +208,7 @@ func (h *Header) StringIndented(indent string) string {
indent, h.ValidatorsHash,
indent, h.AppHash,
indent, h.ConsensusHash,
indent, h.ResultsHash,
indent, h.LastResultsHash,
indent, h.Hash())
}
+3 -10
View File
@@ -1,10 +1,6 @@
package types
import (
"fmt"
"golang.org/x/crypto/ripemd160"
abci "github.com/tendermint/abci/types"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/go-wire/data"
@@ -14,18 +10,15 @@ import (
//-----------------------------------------------------------------------------
// ABCIResult is the deterministic component of a ResponseDeliverTx.
// TODO: add Tags
type ABCIResult struct {
Code uint32 `json:"code"`
Data data.Bytes `json:"data"`
}
// Hash returns the canonical json hash of the ABCIResult
// Hash returns the canonical hash of the ABCIResult
func (a ABCIResult) Hash() []byte {
// stupid canonical json output, easy to check in any language
bs := fmt.Sprintf(`{"code":%d,"data":"%s"}`, a.Code, a.Data)
var hasher = ripemd160.New()
hasher.Write([]byte(bs))
return hasher.Sum(nil)
return wire.BinaryRipemd160(a)
}
// ABCIResults wraps the deliver tx results to return a proof