Skip to content

Commit

Permalink
blockchain, wire: rename ToString() to String()
Browse files Browse the repository at this point in the history
Doing this allows pretty printing because for %v go will call String()
instead of printing out a byte slice.
  • Loading branch information
kcalvinalvin committed May 2, 2024
1 parent 293b25c commit 107896f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blockchain/utreexoviewpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ func (b *BlockChain) VerifyUData(ud *wire.UData, txIns []*wire.TxIn, remember bo
for i, txIn := range txIns {
leafHash := ud.LeafDatas[i].LeafHash()
str += fmt.Sprintf("txIn: %s, leafdata: %s, hash %s\n", txIn.PreviousOutPoint.String(),
ud.LeafDatas[i].ToString(), hex.EncodeToString(leafHash[:]))
ud.LeafDatas[i].String(), hex.EncodeToString(leafHash[:]))
}
str += fmt.Sprintf("err: %s", err.Error())
return fmt.Errorf(str)
Expand Down
4 changes: 2 additions & 2 deletions wire/leaf.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ func (l *LeafData) LeafHash() [32]byte {
return *(*[32]byte)(digest.Sum(nil))
}

// ToString turns a LeafData into a string for logging.
func (l *LeafData) ToString() (s string) {
// String turns a LeafData into a string for logging.
func (l *LeafData) String() (s string) {
s += fmt.Sprintf("BlockHash:%s,", hex.EncodeToString(l.BlockHash[:]))
s += fmt.Sprintf("OutPoint:%s,", l.OutPoint.String())
s += fmt.Sprintf("Amount:%d,", l.Amount)
Expand Down

0 comments on commit 107896f

Please sign in to comment.