Merge branch 'develop' into jae/aminoify

This commit is contained in:
Ethan Buchman
2018-04-07 16:16:53 +03:00
95 changed files with 2317 additions and 770 deletions

View File

@ -156,9 +156,8 @@ func (b *Block) StringIndented(indent string) string {
func (b *Block) StringShort() string {
if b == nil {
return "nil-Block"
} else {
return fmt.Sprintf("Block#%v", b.Hash())
}
return fmt.Sprintf("Block#%v", b.Hash())
}
//-----------------------------------------------------------------------------
@ -192,9 +191,11 @@ type Header struct {
}
// Hash returns the hash of the header.
// Returns nil if ValidatorHash is missing.
// Returns nil if ValidatorHash is missing,
// since a Header is not valid unless there is
// a ValidaotrsHash (corresponding to the validator set).
func (h *Header) Hash() cmn.HexBytes {
if len(h.ValidatorsHash) == 0 {
if h == nil || len(h.ValidatorsHash) == 0 {
return nil
}
return merkle.SimpleHashFromMap(map[string]merkle.Hasher{
@ -230,7 +231,7 @@ func (h *Header) StringIndented(indent string) string {
%s Data: %v
%s Validators: %v
%s App: %v
%s Conensus: %v
%s Consensus: %v
%s Results: %v
%s Evidence: %v
%s}#%v`,
@ -428,6 +429,9 @@ type Data struct {
// Hash returns the hash of the data
func (data *Data) Hash() cmn.HexBytes {
if data == nil {
return (Txs{}).Hash()
}
if data.hash == nil {
data.hash = data.Txs.Hash() // NOTE: leaves of merkle tree are TxIDs
}