diff --git a/eth/rpc/client.go b/eth/rpc/client.go index 9bb75f3eb..d56be1c5a 100644 --- a/eth/rpc/client.go +++ b/eth/rpc/client.go @@ -300,7 +300,7 @@ func (c *Client) CallContext(ctx context.Context, result interface{}, method str case len(resp.Result) == 0: return ErrNoResult default: - return json.Unmarshal(resp.Result, &result) + return json.Unmarshal(resp.Result, result) } } diff --git a/eth/rpc/json.go b/eth/rpc/json.go index 0c661aac6..1d48315d1 100644 --- a/eth/rpc/json.go +++ b/eth/rpc/json.go @@ -19,6 +19,7 @@ package rpc import ( "bytes" "context" + std_json "encoding/json" "errors" "fmt" "github.com/goccy/go-json" @@ -239,7 +240,7 @@ func parseMessage(raw json.RawMessage) ([]*jsonrpcMessage, bool) { json.Unmarshal(raw, &msgs[0]) return msgs, false } - dec := json.NewDecoder(bytes.NewReader(raw)) + dec := std_json.NewDecoder(bytes.NewReader(raw)) dec.Token() // skip '[' var msgs []*jsonrpcMessage for dec.More() { diff --git a/eth/rpc/testdata/invalid-syntax.json b/eth/rpc/testdata/invalid-syntax.json index b19429960..24c06f68f 100644 --- a/eth/rpc/testdata/invalid-syntax.json +++ b/eth/rpc/testdata/invalid-syntax.json @@ -1,5 +1,5 @@ // This test checks that an error is written for invalid JSON requests. --> 'f -<-- {"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"invalid character '\\'' looking for beginning of value"}} +<-- {"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"json: invalid character \n as bool(false)"}}