Changed strings.Contains(?, "{") to bytes.IndexOf(?, '{')>-1
This commit is contained in:
parent
4fb5272063
commit
94451d7a9c
1 changed files with 4 additions and 4 deletions
|
@ -370,7 +370,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
|
||||||
// getaddednodeinfo can either return a JSON object or a
|
// getaddednodeinfo can either return a JSON object or a
|
||||||
// slice of strings depending on the verbose flag. Choose the
|
// slice of strings depending on the verbose flag. Choose the
|
||||||
// right form accordingly.
|
// right form accordingly.
|
||||||
if strings.Contains(string(objmap["result"]), "{") {
|
if bytes.IndexByte(objmap["result"], '{') > -1 {
|
||||||
var res []GetAddedNodeInfoResult
|
var res []GetAddedNodeInfoResult
|
||||||
err = json.Unmarshal(objmap["result"], &res)
|
err = json.Unmarshal(objmap["result"], &res)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -393,7 +393,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
|
||||||
// getblock can either return a JSON object or a hex-encoded
|
// getblock can either return a JSON object or a hex-encoded
|
||||||
// string depending on the verbose flag. Choose the right form
|
// string depending on the verbose flag. Choose the right form
|
||||||
// accordingly.
|
// accordingly.
|
||||||
if strings.Contains(string(objmap["result"]), "{") {
|
if bytes.IndexByte(objmap["result"], '{') > -1 {
|
||||||
var res BlockResult
|
var res BlockResult
|
||||||
err = json.Unmarshal(objmap["result"], &res)
|
err = json.Unmarshal(objmap["result"], &res)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -463,7 +463,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
|
||||||
// getrawmempool can either return a map of JSON objects or
|
// getrawmempool can either return a map of JSON objects or
|
||||||
// an array of strings depending on the verbose flag. Choose
|
// an array of strings depending on the verbose flag. Choose
|
||||||
// the right form accordingly.
|
// the right form accordingly.
|
||||||
if strings.Contains(string(objmap["result"]), "{") {
|
if bytes.IndexByte(objmap["result"], '{') > -1 {
|
||||||
var res map[string]GetRawMempoolResult
|
var res map[string]GetRawMempoolResult
|
||||||
err = json.Unmarshal(objmap["result"], &res)
|
err = json.Unmarshal(objmap["result"], &res)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -486,7 +486,7 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) {
|
||||||
// getwork can either return a JSON object or a boolean
|
// getwork can either return a JSON object or a boolean
|
||||||
// depending on whether or not data was provided. Choose the
|
// depending on whether or not data was provided. Choose the
|
||||||
// right form accordingly.
|
// right form accordingly.
|
||||||
if strings.Contains(string(objmap["result"]), "{") {
|
if bytes.IndexByte(objmap["result"], '{') > -1 {
|
||||||
var res GetWorkResult
|
var res GetWorkResult
|
||||||
err = json.Unmarshal(objmap["result"], &res)
|
err = json.Unmarshal(objmap["result"], &res)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue