From 4fb52720636a06de7fe22ea2f22538e9458681a5 Mon Sep 17 00:00:00 2001 From: GeertJohan Date: Sun, 4 May 2014 17:12:32 +0200 Subject: [PATCH] Return pointer to TxRawResult and use bytes.IndexByte instead of Strings.Contains --- jsonresults.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jsonresults.go b/jsonresults.go index 1e87d9aa..a723d299 100644 --- a/jsonresults.go +++ b/jsonresults.go @@ -5,6 +5,7 @@ package btcjson import ( + "bytes" "encoding/json" "fmt" "strings" @@ -426,12 +427,12 @@ func ReadResultCmd(cmd string, message []byte) (Reply, error) { case "getrawtransaction": // getrawtransaction can either return a JSON object or a // hex-encoded string depending on the verbose flag. Choose the - // right form accordingly. - if strings.Contains(string(objmap["result"]), "{") { + // right form accordingly.= + if bytes.IndexByte(objmap["result"], '{') > -1 { var res TxRawResult err = json.Unmarshal(objmap["result"], &res) if err == nil { - result.Result = res + result.Result = &res } } else { var res string