From 385bae25d8a19e5ec76485defa784c9fd7db5846 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 25 Nov 2025 22:56:35 +0100 Subject: [PATCH] Update json.go --- common/hexutil/json.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/hexutil/json.go b/common/hexutil/json.go index 6b9f412078..2a5ba7054c 100644 --- a/common/hexutil/json.go +++ b/common/hexutil/json.go @@ -42,7 +42,8 @@ type Bytes []byte // MarshalText implements encoding.TextMarshaler func (b Bytes) MarshalText() ([]byte, error) { result := make([]byte, len(b)*2+2) - copy(result, `0x`) + result[0] = '0' + result[1] = 'x' hex.Encode(result[2:], b) return result, nil } @@ -277,7 +278,8 @@ type Uint64 uint64 // MarshalText implements encoding.TextMarshaler. func (b Uint64) MarshalText() ([]byte, error) { buf := make([]byte, 2, 10) - copy(buf, `0x`) + buf[0] = '0' + buf[1] = 'x' buf = strconv.AppendUint(buf, uint64(b), 16) return buf, nil }