Skip to content

Commit 27865d0

Browse files
committed
print hash
1 parent 6be5e1c commit 27865d0

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

types/block.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package types
22

33
import (
44
"bytes"
5+
"encoding/hex"
56
"errors"
67
"fmt"
78
"strings"
@@ -474,7 +475,9 @@ func (h *Header) Hash() cmtbytes.HexBytes {
474475
if err != nil {
475476
return nil
476477
}
477-
return merkle.HashFromByteSlices([][]byte{
478+
fmt.Printf("h.ImplicitHash: %X\n", hex.EncodeToString(h.ImplicitHash))
479+
480+
merkleHash1 := merkle.HashFromByteSlices([][]byte{
478481
hbz,
479482
cdcEncode(h.ChainID),
480483
cdcEncode(h.Height),
@@ -491,6 +494,25 @@ func (h *Header) Hash() cmtbytes.HexBytes {
491494
cdcEncode(h.ProposerAddress),
492495
cdcEncode(h.ImplicitHash),
493496
})
497+
merkleHash2 := merkle.HashFromByteSlices([][]byte{
498+
hbz,
499+
cdcEncode(h.ChainID),
500+
cdcEncode(h.Height),
501+
pbt,
502+
bzbi,
503+
cdcEncode(h.LastCommitHash),
504+
cdcEncode(h.DataHash),
505+
cdcEncode(h.ValidatorsHash),
506+
cdcEncode(h.NextValidatorsHash),
507+
cdcEncode(h.ConsensusHash),
508+
cdcEncode(h.AppHash),
509+
cdcEncode(h.LastResultsHash),
510+
cdcEncode(h.EvidenceHash),
511+
cdcEncode(h.ProposerAddress),
512+
})
513+
fmt.Printf("merkleHash1: %X\n", hex.EncodeToString(merkleHash1))
514+
fmt.Printf("merkleHash2: %X\n", hex.EncodeToString(merkleHash2))
515+
return merkleHash1
494516
}
495517

496518
// StringIndented returns an indented string representation of the header.

0 commit comments

Comments
 (0)