diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-04 07:29:29 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-04 07:29:29 +0800 |
commit | 55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd (patch) | |
tree | 34ec5ce35049377792ccc33892191b76fc49069a /rpc/message.go | |
parent | 07590196a5ee1a63856f1653516da950dfa4966b (diff) | |
download | go-tangerine-55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd.tar go-tangerine-55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd.tar.gz go-tangerine-55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd.tar.bz2 go-tangerine-55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd.tar.lz go-tangerine-55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd.tar.xz go-tangerine-55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd.tar.zst go-tangerine-55ed0ff07c6cf2dc8b422a3bf8d623a039ad6dbd.zip |
Update RPC message format
Diffstat (limited to 'rpc/message.go')
-rw-r--r-- | rpc/message.go | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/rpc/message.go b/rpc/message.go index 26fac9d37..054b7a578 100644 --- a/rpc/message.go +++ b/rpc/message.go @@ -33,30 +33,29 @@ const ( ErrorDecodeArgs = "Error: Could not decode arguments" ) -type ErrorResponse struct { - Error bool `json:"error"` - ErrorText string `json:"errorText"` +type RpcRequest struct { + JsonRpc string `json:"jsonrpc"` + ID int `json:"id"` + Method string `json:"method"` + Params []json.RawMessage `json:"params"` } type RpcSuccessResponse struct { ID int `json:"id"` JsonRpc string `json:"jsonrpc"` - Error bool `json:"error"` Result interface{} `json:"result"` } type RpcErrorResponse struct { - ID int `json:"id"` - JsonRpc string `json:"jsonrpc"` - Error bool `json:"error"` - ErrorText string `json:"errortext"` + ID *int `json:"id"` + JsonRpc string `json:"jsonrpc"` + Error *RpcErrorObject `json:"error"` } -type RpcRequest struct { - JsonRpc string `json:"jsonrpc"` - ID int `json:"id"` - Method string `json:"method"` - Params []json.RawMessage `json:"params"` +type RpcErrorObject struct { + Code int `json:"code"` + Message string `json:"message"` + // Data interface{} `json:"data"` } func NewErrorResponse(msg string) error { |