common/math: encode nil HexOrDecimal256 as 0x0

This commit is contained in:
Felix Lange 2017-04-04 02:08:07 +02:00
parent 2a69d5a470
commit 5077f024d5

View file

@ -51,6 +51,9 @@ func (i *HexOrDecimal256) UnmarshalText(input []byte) error {
// MarshalText implements encoding.TextMarshaler. // MarshalText implements encoding.TextMarshaler.
func (i *HexOrDecimal256) MarshalText() ([]byte, error) { func (i *HexOrDecimal256) MarshalText() ([]byte, error) {
if i == nil {
return []byte("0x0"), nil
}
return []byte(fmt.Sprintf("%#x", (*big.Int)(i))), nil return []byte(fmt.Sprintf("%#x", (*big.Int)(i))), nil
} }