@ -12,6 +12,7 @@ import (
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/crypto/tmhash"
"github.com/tendermint/tendermint/crypto/tmhash"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
cmn "github.com/tendermint/tendermint/libs/common"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/version"
"github.com/tendermint/tendermint/version"
)
)
@ -156,7 +157,7 @@ func (b *Block) fillHeader() {
// Hash computes and returns the block hash.
// Hash computes and returns the block hash.
// If the block is incomplete, block hash is nil for safety.
// If the block is incomplete, block hash is nil for safety.
func ( b * Block ) Hash ( ) cmn . HexBytes {
func ( b * Block ) Hash ( ) tmbytes . HexBytes {
if b == nil {
if b == nil {
return nil
return nil
}
}
@ -329,20 +330,20 @@ type Header struct {
LastBlockID BlockID ` json:"last_block_id" `
LastBlockID BlockID ` json:"last_block_id" `
// hashes of block data
// hashes of block data
LastCommitHash cmn . HexBytes ` json:"last_commit_hash" ` // commit from validators from the last block
DataHash cmn . HexBytes ` json:"data_hash" ` // transactions
LastCommitHash tmbytes . HexBytes ` json:"last_commit_hash" ` // commit from validators from the last block
DataHash tmbytes . HexBytes ` json:"data_hash" ` // transactions
// hashes from the app output from the prev block
// hashes from the app output from the prev block
ValidatorsHash cmn . HexBytes ` json:"validators_hash" ` // validators for the current block
NextValidatorsHash cmn . HexBytes ` json:"next_validators_hash" ` // validators for the next block
ConsensusHash cmn . HexBytes ` json:"consensus_hash" ` // consensus params for current block
AppHash cmn . HexBytes ` json:"app_hash" ` // state after txs from the previous block
ValidatorsHash tmbytes . HexBytes ` json:"validators_hash" ` // validators for the current block
NextValidatorsHash tmbytes . HexBytes ` json:"next_validators_hash" ` // validators for the next block
ConsensusHash tmbytes . HexBytes ` json:"consensus_hash" ` // consensus params for current block
AppHash tmbytes . HexBytes ` json:"app_hash" ` // state after txs from the previous block
// root hash of all results from the txs from the previous block
// root hash of all results from the txs from the previous block
LastResultsHash cmn . HexBytes ` json:"last_results_hash" `
LastResultsHash tmbytes . HexBytes ` json:"last_results_hash" `
// consensus info
// consensus info
EvidenceHash cmn . HexBytes ` json:"evidence_hash" ` // evidence included in the block
ProposerAddress Address ` json:"proposer_address" ` // original proposer of the block
EvidenceHash tmbytes . HexBytes ` json:"evidence_hash" ` // evidence included in the block
ProposerAddress Address ` json:"proposer_address" ` // original proposer of the block
}
}
// Populate the Header with state-derived data.
// Populate the Header with state-derived data.
@ -372,7 +373,7 @@ func (h *Header) Populate(
// Returns nil if ValidatorHash is missing,
// Returns nil if ValidatorHash is missing,
// since a Header is not valid unless there is
// since a Header is not valid unless there is
// a ValidatorsHash (corresponding to the validator set).
// a ValidatorsHash (corresponding to the validator set).
func ( h * Header ) Hash ( ) cmn . HexBytes {
func ( h * Header ) Hash ( ) tmbytes . HexBytes {
if h == nil || len ( h . ValidatorsHash ) == 0 {
if h == nil || len ( h . ValidatorsHash ) == 0 {
return nil
return nil
}
}
@ -479,8 +480,8 @@ func (cs CommitSig) Absent() bool {
func ( cs CommitSig ) String ( ) string {
func ( cs CommitSig ) String ( ) string {
return fmt . Sprintf ( "CommitSig{%X by %X on %v @ %s}" ,
return fmt . Sprintf ( "CommitSig{%X by %X on %v @ %s}" ,
cmn . Fingerprint ( cs . Signature ) ,
cmn . Fingerprint ( cs . ValidatorAddress ) ,
tmbytes . Fingerprint ( cs . Signature ) ,
tmbytes . Fingerprint ( cs . ValidatorAddress ) ,
cs . BlockIDFlag ,
cs . BlockIDFlag ,
CanonicalTime ( cs . Timestamp ) )
CanonicalTime ( cs . Timestamp ) )
}
}
@ -559,7 +560,7 @@ type Commit struct {
// Memoized in first call to corresponding method.
// Memoized in first call to corresponding method.
// NOTE: can't memoize in constructor because constructor isn't used for
// NOTE: can't memoize in constructor because constructor isn't used for
// unmarshaling.
// unmarshaling.
hash cmn . HexBytes
hash tmbytes . HexBytes
bitArray * cmn . BitArray
bitArray * cmn . BitArray
}
}
@ -696,7 +697,7 @@ func (commit *Commit) ValidateBasic() error {
}
}
// Hash returns the hash of the commit
// Hash returns the hash of the commit
func ( commit * Commit ) Hash ( ) cmn . HexBytes {
func ( commit * Commit ) Hash ( ) tmbytes . HexBytes {
if commit == nil {
if commit == nil {
return nil
return nil
}
}
@ -809,11 +810,11 @@ type Data struct {
Txs Txs ` json:"txs" `
Txs Txs ` json:"txs" `
// Volatile
// Volatile
hash cmn . HexBytes
hash tmbytes . HexBytes
}
}
// Hash returns the hash of the data
// Hash returns the hash of the data
func ( data * Data ) Hash ( ) cmn . HexBytes {
func ( data * Data ) Hash ( ) tmbytes . HexBytes {
if data == nil {
if data == nil {
return ( Txs { } ) . Hash ( )
return ( Txs { } ) . Hash ( )
}
}
@ -850,11 +851,11 @@ type EvidenceData struct {
Evidence EvidenceList ` json:"evidence" `
Evidence EvidenceList ` json:"evidence" `
// Volatile
// Volatile
hash cmn . HexBytes
hash tmbytes . HexBytes
}
}
// Hash returns the hash of the data.
// Hash returns the hash of the data.
func ( data * EvidenceData ) Hash ( ) cmn . HexBytes {
func ( data * EvidenceData ) Hash ( ) tmbytes . HexBytes {
if data . hash == nil {
if data . hash == nil {
data . hash = data . Evidence . Hash ( )
data . hash = data . Evidence . Hash ( )
}
}
@ -885,8 +886,8 @@ func (data *EvidenceData) StringIndented(indent string) string {
// BlockID defines the unique ID of a block as its Hash and its PartSetHeader
// BlockID defines the unique ID of a block as its Hash and its PartSetHeader
type BlockID struct {
type BlockID struct {
Hash cmn . HexBytes ` json:"hash" `
PartsHeader PartSetHeader ` json:"parts" `
Hash tmbytes . HexBytes ` json:"hash" `
PartsHeader PartSetHeader ` json:"parts" `
}
}
// Equals returns true if the BlockID matches the given BlockID
// Equals returns true if the BlockID matches the given BlockID