aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-05-02 21:24:34 +0800
committerGitHub <noreply@github.com>2017-05-02 21:24:34 +0800
commit0255ed6335a6bb7fee210ba0ce3326b8669d0f11 (patch)
treeaaaaa702ae8da22f5830d6ee5e96325ffd486279
parent5494e6e7ab384c7540147adb2a7206e57c99334b (diff)
parent32db5716816ef6fddb0d943fc0083c89127e8533 (diff)
downloadgo-tangerine-0255ed6335a6bb7fee210ba0ce3326b8669d0f11.tar
go-tangerine-0255ed6335a6bb7fee210ba0ce3326b8669d0f11.tar.gz
go-tangerine-0255ed6335a6bb7fee210ba0ce3326b8669d0f11.tar.bz2
go-tangerine-0255ed6335a6bb7fee210ba0ce3326b8669d0f11.tar.lz
go-tangerine-0255ed6335a6bb7fee210ba0ce3326b8669d0f11.tar.xz
go-tangerine-0255ed6335a6bb7fee210ba0ce3326b8669d0f11.tar.zst
go-tangerine-0255ed6335a6bb7fee210ba0ce3326b8669d0f11.zip
Merge pull request #14403 from fjl/console-number
console: avoid float64 when remarshaling parameters
-rw-r--r--console/bridge.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/console/bridge.go b/console/bridge.go
index 6db54eb21..75be68188 100644
--- a/console/bridge.go
+++ b/console/bridge.go
@@ -20,6 +20,7 @@ import (
"encoding/json"
"fmt"
"io"
+ "strings"
"time"
"github.com/ethereum/go-ethereum/log"
@@ -240,17 +241,19 @@ func (b *bridge) Send(call otto.FunctionCall) (response otto.Value) {
throwJSException(err.Error())
}
var (
- rawReq = []byte(reqVal.String())
+ rawReq = reqVal.String()
+ dec = json.NewDecoder(strings.NewReader(rawReq))
reqs []jsonrpcCall
batch bool
)
+ dec.UseNumber() // avoid float64s
if rawReq[0] == '[' {
batch = true
- json.Unmarshal(rawReq, &reqs)
+ dec.Decode(&reqs)
} else {
batch = false
reqs = make([]jsonrpcCall, 1)
- json.Unmarshal(rawReq, &reqs[0])
+ dec.Decode(&reqs[0])
}
// Execute the requests.