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
28e5fc83
Commit
28e5fc83
authored
Mar 20, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pretty
parent
b3329bc6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
api.go
rpc/api.go
+14
-12
No files found.
rpc/api.go
View file @
28e5fc83
...
@@ -111,7 +111,8 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -111,7 +111,8 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
case
"net_listening"
:
case
"net_listening"
:
*
reply
=
p
.
xeth
()
.
IsListening
()
*
reply
=
p
.
xeth
()
.
IsListening
()
case
"net_peerCount"
:
case
"net_peerCount"
:
*
reply
=
common
.
ToHex
(
big
.
NewInt
(
int64
(
p
.
xeth
()
.
PeerCount
()))
.
Bytes
())
v
:=
p
.
xeth
()
.
PeerCount
()
*
reply
=
common
.
ToHex
(
big
.
NewInt
(
int64
(
v
))
.
Bytes
())
case
"eth_coinbase"
:
case
"eth_coinbase"
:
// TODO handling of empty coinbase due to lack of accounts
// TODO handling of empty coinbase due to lack of accounts
res
:=
p
.
xeth
()
.
Coinbase
()
res
:=
p
.
xeth
()
.
Coinbase
()
...
@@ -123,11 +124,13 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -123,11 +124,13 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
case
"eth_mining"
:
case
"eth_mining"
:
*
reply
=
p
.
xeth
()
.
IsMining
()
*
reply
=
p
.
xeth
()
.
IsMining
()
case
"eth_gasPrice"
:
case
"eth_gasPrice"
:
*
reply
=
common
.
ToHex
(
p
.
xeth
()
.
DefaultGas
()
.
Bytes
())
v
:=
p
.
xeth
()
.
DefaultGas
()
*
reply
=
common
.
ToHex
(
v
.
Bytes
())
case
"eth_accounts"
:
case
"eth_accounts"
:
*
reply
=
p
.
xeth
()
.
Accounts
()
*
reply
=
p
.
xeth
()
.
Accounts
()
case
"eth_blockNumber"
:
case
"eth_blockNumber"
:
*
reply
=
common
.
ToHex
(
p
.
xeth
()
.
Backend
()
.
ChainManager
()
.
CurrentBlock
()
.
Number
()
.
Bytes
())
v
:=
p
.
xeth
()
.
Backend
()
.
ChainManager
()
.
CurrentBlock
()
.
Number
()
*
reply
=
common
.
ToHex
(
v
.
Bytes
())
case
"eth_getBalance"
:
case
"eth_getBalance"
:
args
:=
new
(
GetBalanceArgs
)
args
:=
new
(
GetBalanceArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
@@ -138,7 +141,8 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -138,7 +141,8 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
return
err
}
}
*
reply
=
common
.
ToHex
(
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
.
Balance
()
.
Bytes
())
v
:=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
.
Balance
()
*
reply
=
common
.
ToHex
(
v
.
Bytes
())
case
"eth_getStorage"
,
"eth_storageAt"
:
case
"eth_getStorage"
,
"eth_storageAt"
:
args
:=
new
(
GetStorageArgs
)
args
:=
new
(
GetStorageArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
@@ -174,18 +178,16 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -174,18 +178,16 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
return
err
}
}
block
:=
p
.
xeth
()
.
EthBlockByHash
(
args
.
BlockHash
)
block
:=
NewBlockRes
(
p
.
xeth
()
.
EthBlockByHash
(
args
.
BlockHash
))
br
:=
NewBlockRes
(
block
)
*
reply
=
common
.
ToHex
(
big
.
NewInt
(
int64
(
len
(
block
.
Transactions
)))
.
Bytes
())
*
reply
=
common
.
ToHex
(
big
.
NewInt
(
int64
(
len
(
br
.
Transactions
)))
.
Bytes
())
case
"eth_getBlockTransactionCountByNumber"
:
case
"eth_getBlockTransactionCountByNumber"
:
args
:=
new
(
GetBlockByNumberArgs
)
args
:=
new
(
GetBlockByNumberArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
return
err
return
err
}
}
block
:=
p
.
xeth
()
.
EthBlockByNumber
(
args
.
BlockNumber
)
block
:=
NewBlockRes
(
p
.
xeth
()
.
EthBlockByNumber
(
args
.
BlockNumber
))
br
:=
NewBlockRes
(
block
)
*
reply
=
common
.
ToHex
(
big
.
NewInt
(
int64
(
len
(
block
.
Transactions
)))
.
Bytes
())
*
reply
=
common
.
ToHex
(
big
.
NewInt
(
int64
(
len
(
br
.
Transactions
)))
.
Bytes
())
case
"eth_getUncleCountByBlockHash"
:
case
"eth_getUncleCountByBlockHash"
:
args
:=
new
(
GetBlockByHashArgs
)
args
:=
new
(
GetBlockByHashArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
@@ -234,12 +236,12 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -234,12 +236,12 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
return
err
}
}
result
,
err
:=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
Call
(
args
.
From
,
args
.
To
,
args
.
Value
.
String
(),
args
.
Gas
.
String
(),
args
.
GasPrice
.
String
(),
args
.
Data
)
v
,
err
:=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
Call
(
args
.
From
,
args
.
To
,
args
.
Value
.
String
(),
args
.
Gas
.
String
(),
args
.
GasPrice
.
String
(),
args
.
Data
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
*
reply
=
result
*
reply
=
v
case
"eth_flush"
:
case
"eth_flush"
:
return
NewNotImplementedError
(
req
.
Method
)
return
NewNotImplementedError
(
req
.
Method
)
case
"eth_getBlockByHash"
:
case
"eth_getBlockByHash"
:
...
...
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