switch to jsoniter
parent
8bf42e0bf4
commit
b112a18aa5
|
@ -26,10 +26,10 @@
|
|||
revision = "501929d3d046174c3d39f0ea54ece471aa17238c"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/hashicorp/golang-lru"
|
||||
packages = [".","simplelru"]
|
||||
revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6"
|
||||
name = "github.com/json-iterator/go"
|
||||
packages = ["."]
|
||||
revision = "36b14963da70d11297d313183d7e6388c8510e1e"
|
||||
version = "1.0.0"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
@ -46,6 +46,6 @@
|
|||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "3bb30a1d65e170c9b0f282efa56af8096dc74f149744743dddd27f26e1880612"
|
||||
inputs-digest = "827d405fafae0abd3b872001a1c24ad4e89a6302acd15d6eb1f3a5dfc6b18cdd"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
|
|
@ -40,3 +40,7 @@
|
|||
[[constraint]]
|
||||
branch = "master"
|
||||
name = "github.com/tecbot/gorocksdb"
|
||||
|
||||
[[constraint]]
|
||||
name = "github.com/json-iterator/go"
|
||||
version = "1.0.0"
|
||||
|
|
|
@ -3,11 +3,12 @@ package main
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
type RPCError struct {
|
||||
|
@ -303,7 +304,7 @@ func (b *BitcoinRPC) GetAddress(txid string, vout uint32) (string, error) {
|
|||
}
|
||||
|
||||
func (b *BitcoinRPC) call(req interface{}, res interface{}) error {
|
||||
httpData, err := json.Marshal(req)
|
||||
httpData, err := jsoniter.Marshal(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -317,5 +318,5 @@ func (b *BitcoinRPC) call(req interface{}, res interface{}) error {
|
|||
return err
|
||||
}
|
||||
defer httpRes.Body.Close()
|
||||
return json.NewDecoder(httpRes.Body).Decode(&res)
|
||||
return jsoniter.NewDecoder(httpRes.Body).Decode(res)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue