Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
309788de
Commit
309788de
authored
9 years ago
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpc: update the xeth over RPC API to use the success/failure messages
parent
f6367548
master
v1.10.12
v1.10.12-modified
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
xeth.go
rpc/xeth.go
+13
-5
No files found.
rpc/xeth.go
View file @
309788de
...
...
@@ -53,7 +53,7 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac
Method
:
method
,
Params
:
data
,
}
// Send the request over and
process
the response
// Send the request over and
retrieve
the response
if
err
:=
self
.
client
.
Send
(
req
);
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -61,9 +61,17 @@ func (self *Xeth) Call(method string, params []interface{}) (map[string]interfac
if
err
!=
nil
{
return
nil
,
err
}
value
,
ok
:=
res
.
(
map
[
string
]
interface
{})
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"Invalid response type: have %v, want %v"
,
reflect
.
TypeOf
(
res
),
reflect
.
TypeOf
(
make
(
map
[
string
]
interface
{})))
// Ensure the response is valid, and extract the results
success
,
isSuccessResponse
:=
res
.
(
*
shared
.
SuccessResponse
)
failure
,
isFailureResponse
:=
res
.
(
*
shared
.
ErrorResponse
)
switch
{
case
isFailureResponse
:
return
nil
,
fmt
.
Errorf
(
"Method invocation failed: %v"
,
failure
.
Error
)
case
isSuccessResponse
:
return
success
.
Result
.
(
map
[
string
]
interface
{}),
nil
default
:
return
nil
,
fmt
.
Errorf
(
"Invalid response type: %v"
,
reflect
.
TypeOf
(
res
))
}
return
value
,
nil
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment