From 894d5e23aa1680cbf329fd7d1d610a0742589a6f Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 26 Jun 2014 21:47:29 -0500 Subject: [PATCH] Unmarshal the SubmitBlock error. The string needs to be unmarshaled rather than returned directly otherwise it will have an extra set of quotes plus it's safter to properly unmarshal it. Pointed out by @jrick. --- mining.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mining.go b/mining.go index d35db716..d299776f 100644 --- a/mining.go +++ b/mining.go @@ -375,9 +375,14 @@ func (r FutureSubmitBlockResult) Receive() error { return err } - resStr := string(res) - if resStr != "null" { - return errors.New(resStr) + if string(res) != "null" { + var result string + err = json.Unmarshal(res, &result) + if err != nil { + return err + } + + return errors.New(result) } return nil