mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 06:36:43 +00:00
rpc: use go-json
This commit is contained in:
parent
5b79f4d2da
commit
ec880b1737
1 changed files with 4 additions and 2 deletions
|
|
@ -27,6 +27,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
gojson "github.com/goccy/go-json"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -308,7 +310,7 @@ func isBatch(raw json.RawMessage) bool {
|
||||||
// given types. It returns the parsed values or an error when the args could not be
|
// given types. It returns the parsed values or an error when the args could not be
|
||||||
// parsed. Missing optional arguments are returned as reflect.Zero values.
|
// parsed. Missing optional arguments are returned as reflect.Zero values.
|
||||||
func parsePositionalArguments(rawArgs json.RawMessage, types []reflect.Type) ([]reflect.Value, error) {
|
func parsePositionalArguments(rawArgs json.RawMessage, types []reflect.Type) ([]reflect.Value, error) {
|
||||||
dec := json.NewDecoder(bytes.NewReader(rawArgs))
|
dec := gojson.NewDecoder(bytes.NewReader(rawArgs))
|
||||||
var args []reflect.Value
|
var args []reflect.Value
|
||||||
tok, err := dec.Token()
|
tok, err := dec.Token()
|
||||||
switch {
|
switch {
|
||||||
|
|
@ -335,7 +337,7 @@ func parsePositionalArguments(rawArgs json.RawMessage, types []reflect.Type) ([]
|
||||||
return args, nil
|
return args, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseArgumentArray(dec *json.Decoder, types []reflect.Type) ([]reflect.Value, error) {
|
func parseArgumentArray(dec *gojson.Decoder, types []reflect.Type) ([]reflect.Value, error) {
|
||||||
args := make([]reflect.Value, 0, len(types))
|
args := make([]reflect.Value, 0, len(types))
|
||||||
for i := 0; dec.More(); i++ {
|
for i := 0; dec.More(); i++ {
|
||||||
if i >= len(types) {
|
if i >= len(types) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue