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
0cde7a4d
Commit
0cde7a4d
authored
Mar 20, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add xethAtStateNum convenience method
parent
efcc93e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
api.go
rpc/api.go
+10
-6
No files found.
rpc/api.go
View file @
0cde7a4d
...
...
@@ -37,6 +37,10 @@ func (self *EthereumApi) xeth() *xeth.XEth {
return
self
.
eth
}
func
(
self
*
EthereumApi
)
xethAtStateNum
(
num
int64
)
*
xeth
.
XEth
{
return
self
.
xeth
()
.
AtStateNum
(
num
)
}
func
(
p
*
EthereumApi
)
GetRequestReply
(
req
*
RpcRequest
,
reply
*
interface
{})
error
{
// Spec at https://github.com/ethereum/wiki/wiki/Generic-JSON-RPC
rpclogger
.
DebugDetailf
(
"%s %s"
,
req
.
Method
,
req
.
Params
)
...
...
@@ -84,7 +88,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
v
:=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
.
Balance
()
v
:=
p
.
xethAtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
.
Balance
()
*
reply
=
common
.
ToHex
(
v
.
Bytes
())
case
"eth_getStorage"
,
"eth_storageAt"
:
args
:=
new
(
GetStorageArgs
)
...
...
@@ -96,7 +100,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
*
reply
=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
.
Storage
()
*
reply
=
p
.
xethAtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
.
Storage
()
case
"eth_getStorageAt"
:
args
:=
new
(
GetStorageAtArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
@@ -106,7 +110,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
state
:=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
state
:=
p
.
xethAtStateNum
(
args
.
BlockNumber
)
.
State
()
.
SafeGet
(
args
.
Address
)
value
:=
state
.
StorageString
(
args
.
Key
)
*
reply
=
common
.
Bytes2Hex
(
value
.
Bytes
())
...
...
@@ -121,7 +125,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
*
reply
=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
TxCountAt
(
args
.
Address
)
*
reply
=
p
.
xethAtStateNum
(
args
.
BlockNumber
)
.
TxCountAt
(
args
.
Address
)
case
"eth_getBlockTransactionCountByHash"
:
args
:=
new
(
GetBlockByHashArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
@@ -164,7 +168,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
if
err
:=
args
.
requirements
();
err
!=
nil
{
return
err
}
*
reply
=
p
.
xeth
()
.
AtStateNum
(
args
.
BlockNumber
)
.
CodeAt
(
args
.
Address
)
*
reply
=
p
.
xethAtStateNum
(
args
.
BlockNumber
)
.
CodeAt
(
args
.
Address
)
case
"eth_sendTransaction"
,
"eth_transact"
:
args
:=
new
(
NewTxArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
@@ -186,7 +190,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
v
,
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
.
xethAtStateNum
(
args
.
BlockNumber
)
.
Call
(
args
.
From
,
args
.
To
,
args
.
Value
.
String
(),
args
.
Gas
.
String
(),
args
.
GasPrice
.
String
(),
args
.
Data
)
if
err
!=
nil
{
return
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