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.
This commit is contained in:
parent
0f6726b9c3
commit
894d5e23aa
1 changed files with 8 additions and 3 deletions
11
mining.go
11
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
|
||||
|
|
Loading…
Reference in a new issue