mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge e7dd1a2730 into 79ca6c7a65
This commit is contained in:
commit
243fcf2bf2
1 changed files with 11 additions and 11 deletions
|
|
@ -85,7 +85,7 @@ type jsonrpcMessage struct {
|
|||
Method string `json:"method,omitempty"`
|
||||
Params json.RawMessage `json:"params,omitempty"`
|
||||
Error *jsonError `json:"error,omitempty"`
|
||||
Result json.RawMessage `json:"result,omitempty"`
|
||||
Result *json.RawMessage `json:"result,omitempty"`
|
||||
}
|
||||
|
||||
func (msg *jsonrpcMessage) isNotification() bool {
|
||||
|
|
@ -310,10 +310,10 @@ func (c *Client) CallContext(ctx context.Context, result interface{}, method str
|
|||
return err
|
||||
case resp.Error != nil:
|
||||
return resp.Error
|
||||
case len(resp.Result) == 0:
|
||||
case resp.Result == nil:
|
||||
return ErrNoResult
|
||||
default:
|
||||
return json.Unmarshal(resp.Result, &result)
|
||||
return json.Unmarshal(*resp.Result, &result)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -381,11 +381,11 @@ func (c *Client) BatchCallContext(ctx context.Context, b []BatchElem) error {
|
|||
elem.Error = resp.Error
|
||||
continue
|
||||
}
|
||||
if len(resp.Result) == 0 {
|
||||
if resp.Result == nil {
|
||||
elem.Error = ErrNoResult
|
||||
continue
|
||||
}
|
||||
elem.Error = json.Unmarshal(resp.Result, elem.Result)
|
||||
elem.Error = json.Unmarshal(*resp.Result, elem.Result)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
@ -665,7 +665,7 @@ func (c *Client) handleResponse(msg *jsonrpcMessage) {
|
|||
op.err = msg.Error
|
||||
return
|
||||
}
|
||||
if op.err = json.Unmarshal(msg.Result, &op.sub.subid); op.err == nil {
|
||||
if op.err = json.Unmarshal(*msg.Result, &op.sub.subid); op.err == nil {
|
||||
go op.sub.start()
|
||||
c.subs[op.sub.subid] = op.sub
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue