HexBytes formatting; Make computeHashFromAunts more defensive

This commit is contained in:
Jae Kwon
2018-04-03 07:02:19 -07:00
parent 3cd4dcf13b
commit f457435199
2 changed files with 12 additions and 3 deletions
+9
View File
@@ -51,3 +51,12 @@ func (bz HexBytes) Bytes() []byte {
func (bz HexBytes) String() string {
return strings.ToUpper(hex.EncodeToString(bz))
}
func (bz HexBytes) Format(s fmt.State, verb rune) {
switch verb {
case 'p':
s.Write([]byte(fmt.Sprintf("%p", bz)))
default:
s.Write([]byte(fmt.Sprintf("%X", []byte(bz))))
}
}