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
b2112729
Commit
b2112729
authored
Jan 13, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
32bed50b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
46 deletions
+9
-46
message.go
rpc/message.go
+0
-21
packages.go
rpc/packages.go
+9
-25
No files found.
rpc/message.go
View file @
b2112729
...
@@ -4,8 +4,6 @@ import (
...
@@ -4,8 +4,6 @@ import (
"bytes"
"bytes"
"encoding/json"
"encoding/json"
"errors"
"errors"
// "github.com/ethereum/go-ethereum/ethutil"
)
)
const
(
const
(
...
@@ -16,30 +14,11 @@ const (
...
@@ -16,30 +14,11 @@ const (
ErrorDecodeArgs
=
"Error: Could not decode arguments"
ErrorDecodeArgs
=
"Error: Could not decode arguments"
)
)
// type JsonResponse interface {
// }
type
ErrorResponse
struct
{
type
ErrorResponse
struct
{
Error
bool
`json:"error"`
Error
bool
`json:"error"`
ErrorText
string
`json:"errorText"`
ErrorText
string
`json:"errorText"`
}
}
// type SuccessRes struct {
// Error bool `json:"error"`
// Result JsonResponse `json:"result"`
// }
// type Message struct {
// Call string `json:"call"`
// Args []interface{} `json:"args"`
// Id int `json:"_id"`
// Data interface{} `json:"data"`
// }
// func (self *Message) Arguments() *ethutil.Value {
// return ethutil.NewValue(self.Args)
// }
type
RpcSuccessResponse
struct
{
type
RpcSuccessResponse
struct
{
ID
int
`json:"id"`
ID
int
`json:"id"`
JsonRpc
string
`json:"jsonrpc"`
JsonRpc
string
`json:"jsonrpc"`
...
...
rpc/packages.go
View file @
b2112729
/*
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
*/
package
rpc
package
rpc
import
(
import
(
// "bytes"
"encoding/json"
"encoding/json"
"math/big"
"math/big"
"strings"
"strings"
// "errors"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
)
)
...
@@ -21,12 +28,9 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
...
@@ -21,12 +28,9 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
return
err
return
err
}
}
// var block xeth.JSBlock
if
args
.
BlockNumber
>
0
{
if
args
.
BlockNumber
>
0
{
// block := p.pipe.BlockByNumber(int32(args.BlockNumber))
*
reply
=
p
.
pipe
.
BlockByNumber
(
args
.
BlockNumber
)
*
reply
=
p
.
pipe
.
BlockByNumber
(
args
.
BlockNumber
)
}
else
{
}
else
{
// block := p.pipe.BlockByHash(args.Hash)
*
reply
=
p
.
pipe
.
BlockByHash
(
args
.
Hash
)
*
reply
=
p
.
pipe
.
BlockByHash
(
args
.
Hash
)
}
}
return
nil
return
nil
...
@@ -97,13 +101,11 @@ func (p *EthereumApi) GetPeerCount(reply *interface{}) error {
...
@@ -97,13 +101,11 @@ func (p *EthereumApi) GetPeerCount(reply *interface{}) error {
func
(
p
*
EthereumApi
)
GetIsListening
(
reply
*
interface
{})
error
{
func
(
p
*
EthereumApi
)
GetIsListening
(
reply
*
interface
{})
error
{
*
reply
=
p
.
pipe
.
IsListening
()
*
reply
=
p
.
pipe
.
IsListening
()
// *reply = NewSuccessRes(GetListeningRes{IsListening: p.pipe.IsListening()})
return
nil
return
nil
}
}
func
(
p
*
EthereumApi
)
GetCoinbase
(
reply
*
interface
{})
error
{
func
(
p
*
EthereumApi
)
GetCoinbase
(
reply
*
interface
{})
error
{
*
reply
=
p
.
pipe
.
CoinBase
()
*
reply
=
p
.
pipe
.
CoinBase
()
// *reply = p.pipe.CoinBase()
return
nil
return
nil
}
}
...
@@ -131,14 +133,6 @@ func (p *EthereumApi) GetBalanceAt(args *GetBalanceArgs, reply *interface{}) err
...
@@ -131,14 +133,6 @@ func (p *EthereumApi) GetBalanceAt(args *GetBalanceArgs, reply *interface{}) err
return
nil
return
nil
}
}
// type JsonArgs interface {
// requirements() error
// }
// type BlockResponse struct {
// JsonResponse
// }
type
GetBlockArgs
struct
{
type
GetBlockArgs
struct
{
BlockNumber
int32
BlockNumber
int32
Hash
string
Hash
string
...
@@ -306,13 +300,3 @@ type BalanceRes struct {
...
@@ -306,13 +300,3 @@ type BalanceRes struct {
Balance
string
`json:"balance"`
Balance
string
`json:"balance"`
Address
string
`json:"address"`
Address
string
`json:"address"`
}
}
// type TestRes struct {
// JsonResponse `json:"-"`
// Answer int `json:"answer"`
// }
// func (p *EthereumApi) Test(args *GetBlockArgs, reply *interface{}) error {
// *reply = NewSuccessRes(TestRes{Answer: 15})
// return nil
// }
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