From cb6797251245f61ca437f4cfaf24e07db6484975 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Thu, 26 Jun 2014 18:04:01 -0500 Subject: [PATCH] Detect error strings on SumitBlock. The submitblock RPC returns a string containing an error if it failed for any reason. This comment detects a non-null return from submitblock and converts that string to an error which is returned. --- mining.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mining.go b/mining.go index b98f89a5..846de39a 100644 --- a/mining.go +++ b/mining.go @@ -369,11 +369,16 @@ type FutureSubmitBlockResult chan *response // Receive waits for the response promised by the future and returns an error if // any occurred when submitting the block. func (r FutureSubmitBlockResult) Receive() error { - _, err := receiveFuture(r) + res, err := receiveFuture(r) if err != nil { return err } + resStr := string(res) + if resStr != "null" { + return errors.New(resStr) + } + return nil }