Browse Source

rpc: fix success response encoding for null return value

The "result" field of JSON-RPC 2.0 responses was omitted
if the result was nil, causing exceptions in web3.js.
Felix Lange 9 năm trước cách đây
mục cha
commit
5728dd381d
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      rpc/json.go

+ 1 - 1
rpc/json.go

@@ -48,7 +48,7 @@ type JSONRequest struct {
 type JSONSuccessResponse struct {
 	Version string      `json:"jsonrpc"`
 	Id      int64       `json:"id"`
-	Result  interface{} `json:"result,omitempty"`
+	Result  interface{} `json:"result"`
 }
 
 // JSON-RPC error object