@@ -2,7 +2,6 @@ package types
2
2
3
3
import (
4
4
"bytes"
5
- "encoding/hex"
6
5
"errors"
7
6
"fmt"
8
7
"strings"
@@ -457,25 +456,31 @@ func (h Header) ValidateBasic() error {
457
456
// since a Header is not valid unless there is
458
457
// a ValidatorsHash (corresponding to the validator set).
459
458
func (h * Header ) Hash () cmtbytes.HexBytes {
459
+ fmt .Printf ("tendermint.Header(): %v\n " , h )
460
460
if h == nil || len (h .ValidatorsHash ) == 0 {
461
+ fmt .Printf ("h == nil || len(h.ValidatorsHash) == 0" )
461
462
return nil
462
463
}
463
464
hbz , err := h .Version .Marshal ()
464
465
if err != nil {
466
+ fmt .Printf ("err1: %v\n " , err )
465
467
return nil
466
468
}
467
469
468
470
pbt , err := gogotypes .StdTimeMarshal (h .Time )
469
471
if err != nil {
472
+ fmt .Printf ("err2: %v\n " , err )
470
473
return nil
471
474
}
472
475
473
476
pbbi := h .LastBlockID .ToProto ()
474
477
bzbi , err := pbbi .Marshal ()
475
478
if err != nil {
479
+ fmt .Printf ("err3: %v\n " , err )
476
480
return nil
477
481
}
478
- fmt .Printf ("h.ImplicitHash: %X\n " , hex .EncodeToString (h .ImplicitHash ))
482
+ // fmt.Printf("h.ImplicitHash: %X\n", h.ImplicitHash)
483
+ // debug.PrintStack()
479
484
480
485
merkleHash1 := merkle .HashFromByteSlices ([][]byte {
481
486
hbz ,
@@ -510,8 +515,8 @@ func (h *Header) Hash() cmtbytes.HexBytes {
510
515
cdcEncode (h .EvidenceHash ),
511
516
cdcEncode (h .ProposerAddress ),
512
517
})
513
- fmt .Printf ("merkleHash1: %X\n " , hex . EncodeToString ( merkleHash1 ) )
514
- fmt .Printf ("merkleHash2: %X\n " , hex . EncodeToString ( merkleHash2 ) )
518
+ fmt .Printf ("merkleHash1: %X\n " , merkleHash1 )
519
+ fmt .Printf ("merkleHash2: %X\n " , merkleHash2 )
515
520
return merkleHash1
516
521
}
517
522
@@ -623,6 +628,7 @@ func HeaderFromProto(ph *cmtproto.Header) (Header, error) {
623
628
// ScrtLabs -> change in
624
629
h .EncryptedRandom = encRandom
625
630
h .ImplicitHash = ph .ImplicitHash
631
+ fmt .Printf ("h.ImplicitHash: %X\n " , h .ImplicitHash )
626
632
// ScrtLabs <- change out
627
633
return * h , h .ValidateBasic ()
628
634
}
0 commit comments