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
a81d835e
Commit
a81d835e
authored
Jan 13, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
961e4da7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
16 deletions
+5
-16
json.go
rpc/json.go
+1
-1
message.go
rpc/message.go
+0
-12
packages.go
rpc/packages.go
+3
-2
server.go
rpc/server.go
+1
-1
No files found.
rpc/json.go
View file @
a81d835e
...
...
@@ -55,7 +55,7 @@ func (self jsonWrapper) ParseRequestBody(req *http.Request) (RpcRequest, error)
}
func
(
self
jsonWrapper
)
GetRequestReply
(
xeth
*
EthereumApi
,
req
*
RpcRequest
,
reply
*
interface
{})
error
{
//
call function for request method
//
Spec at https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
jsonlogger
.
DebugDetailf
(
"%T %s"
,
req
.
Params
,
req
.
Params
)
switch
req
.
Method
{
case
"eth_coinbase"
:
...
...
rpc/message.go
View file @
a81d835e
...
...
@@ -162,18 +162,6 @@ func (req *RpcRequest) ToGetCodeAtArgs() (*GetCodeAtArgs, error) {
return
args
,
nil
}
// func NewSuccessRes(object JsonResponse) string {
// e := SuccessRes{Error: false, Result: object}
// res, err := json.Marshal(e)
// if err != nil {
// // This should never happen
// panic("Creating json error response failed, help")
// }
// success := string(res)
// return success
// // return res
// }
func
NewErrorResponse
(
msg
string
)
error
{
return
errors
.
New
(
msg
)
}
rpc/packages.go
View file @
a81d835e
...
...
@@ -20,7 +20,7 @@ For each request type, define the following:
1. RpcRequest "To" method [message.go], which does basic validation and conversion to "Args" type via json.Decoder()
2. json.Decoder() calls "UnmarshalJSON" defined on each "Args" struct
3. EthereumApi
"Get"
method, taking the "Args" type and replying with an interface to be marshalled to JSON
3. EthereumApi method, taking the "Args" type and replying with an interface to be marshalled to JSON
*/
package
rpc
...
...
@@ -173,7 +173,7 @@ func (obj *GetBlockArgs) UnmarshalJSON(b []byte) (err error) {
obj
.
Hash
=
argstr
return
}
return
NewErrorResponse
(
"Could not determine JSON parameters"
)
return
NewErrorResponse
(
ErrorDecodeArgs
)
}
func
(
obj
*
GetBlockArgs
)
requirements
()
error
{
...
...
@@ -334,6 +334,7 @@ type BalanceRes struct {
Balance
string
`json:"balance"`
Address
string
`json:"address"`
}
type
GetCodeAtArgs
struct
{
Address
string
}
...
...
rpc/server.go
View file @
a81d835e
...
...
@@ -58,7 +58,7 @@ func (s *JsonRpcServer) Start() {
http
.
Handle
(
"/"
,
h
)
err
:=
http
.
Serve
(
s
.
listener
,
nil
)
//
TODO
Complains on shutdown due to listner already being closed
//
FIX
Complains on shutdown due to listner already being closed
if
err
!=
nil
{
jsonlogger
.
Errorln
(
"Error on JSON-RPC interface:"
,
err
)
}
...
...
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