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
bde16138
Commit
bde16138
authored
Mar 20, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inline GetBlockByHash
parent
b56e20be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
31 deletions
+20
-31
api.go
rpc/api.go
+20
-31
No files found.
rpc/api.go
View file @
bde16138
...
...
@@ -97,13 +97,6 @@ func (p *EthereumApi) GetStorageAt(args *GetStorageAtArgs, reply *interface{}) e
return
nil
}
func
(
p
*
EthereumApi
)
GetBlockByHash
(
blockhash
string
,
includetx
bool
)
(
*
BlockRes
,
error
)
{
block
:=
p
.
xeth
()
.
EthBlockByHash
(
blockhash
)
br
:=
NewBlockRes
(
block
)
br
.
fullTx
=
includetx
return
br
,
nil
}
func
(
p
*
EthereumApi
)
GetBlockByNumber
(
blocknum
int64
,
includetx
bool
)
(
*
BlockRes
,
error
)
{
block
:=
p
.
xeth
()
.
EthBlockByNumber
(
blocknum
)
br
:=
NewBlockRes
(
block
)
...
...
@@ -280,11 +273,11 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
v
,
err
:=
p
.
GetBlockByHash
(
args
.
BlockHash
,
args
.
IncludeTxs
)
if
err
!=
nil
{
return
err
}
*
reply
=
v
block
:=
p
.
xeth
()
.
EthBlockByHash
(
args
.
BlockHash
)
br
:=
NewBlockRes
(
block
)
br
.
fullTx
=
args
.
IncludeTxs
*
reply
=
br
case
"eth_getBlockByNumber"
:
args
:=
new
(
GetBlockByNumberArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
@@ -311,14 +304,14 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
v
,
err
:=
p
.
GetBlockByHash
(
args
.
Hash
,
true
)
if
err
!=
nil
{
return
err
}
if
args
.
Index
>
int64
(
len
(
v
.
Transactions
))
||
args
.
Index
<
0
{
block
:=
p
.
xeth
()
.
EthBlockByHash
(
args
.
Hash
)
br
:=
NewBlockRes
(
block
)
br
.
fullTx
=
true
if
args
.
Index
>
int64
(
len
(
br
.
Transactions
))
||
args
.
Index
<
0
{
return
NewValidationError
(
"Index"
,
"does not exist"
)
}
*
reply
=
v
.
Transactions
[
args
.
Index
]
*
reply
=
br
.
Transactions
[
args
.
Index
]
case
"eth_getTransactionByBlockNumberAndIndex"
:
args
:=
new
(
BlockNumIndexArgs
)
if
err
:=
json
.
Unmarshal
(
req
.
Params
,
&
args
);
err
!=
nil
{
...
...
@@ -339,18 +332,15 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
err
}
v
,
err
:=
p
.
GetBlockByHash
(
args
.
Hash
,
false
)
if
err
!=
nil
{
return
err
}
if
args
.
Index
>
int64
(
len
(
v
.
Uncles
))
||
args
.
Index
<
0
{
br
:=
NewBlockRes
(
p
.
xeth
()
.
EthBlockByHash
(
args
.
Hash
))
if
args
.
Index
>
int64
(
len
(
br
.
Uncles
))
||
args
.
Index
<
0
{
return
NewValidationError
(
"Index"
,
"does not exist"
)
}
uncle
,
err
:=
p
.
GetBlockByHash
(
common
.
ToHex
(
v
.
Uncles
[
args
.
Index
]),
false
)
if
err
!=
nil
{
return
err
}
uhash
:=
common
.
ToHex
(
br
.
Uncles
[
args
.
Index
])
uncle
:=
NewBlockRes
(
p
.
xeth
()
.
EthBlockByHash
(
uhash
))
*
reply
=
uncle
case
"eth_getUncleByBlockNumberAndIndex"
:
args
:=
new
(
BlockNumIndexArgs
)
...
...
@@ -366,10 +356,9 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
return
NewValidationError
(
"Index"
,
"does not exist"
)
}
uncle
,
err
:=
p
.
GetBlockByHash
(
common
.
ToHex
(
v
.
Uncles
[
args
.
Index
]),
false
)
if
err
!=
nil
{
return
err
}
uhash
:=
common
.
ToHex
(
v
.
Uncles
[
args
.
Index
])
uncle
:=
NewBlockRes
(
p
.
xeth
()
.
EthBlockByHash
(
uhash
))
*
reply
=
uncle
case
"eth_getCompilers"
:
c
:=
[]
string
{
""
}
...
...
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