mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
common/math: encode nil HexOrDecimal256 as 0x0
This commit is contained in:
parent
2a69d5a470
commit
5077f024d5
1 changed files with 3 additions and 0 deletions
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue