good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
bde16138
Commit
bde16138
authored
Mar 20, 2015
by
Taylor Gerring
Browse files
Options
Downloads
Patches
Plain Diff
inline GetBlockByHash
parent
b56e20be
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
rpc/api.go
+20
-31
20 additions, 31 deletions
rpc/api.go
with
20 additions
and
31 deletions
rpc/api.go
+
20
−
31
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
.
G
etBlockByHash
(
args
.
BlockHash
,
args
.
IncludeTxs
)
if
er
r
!
=
nil
{
return
err
}
*
reply
=
v
block
:=
p
.
x
et
h
()
.
Eth
BlockByHash
(
args
.
BlockHash
)
b
r
:
=
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
.
G
etBlockByHash
(
args
.
Hash
,
true
)
if
er
r
!
=
nil
{
return
err
}
if
args
.
Index
>
int64
(
len
(
v
.
Transactions
))
||
args
.
Index
<
0
{
block
:=
p
.
x
et
h
()
.
Eth
BlockByHash
(
args
.
Hash
)
b
r
:
=
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
{
""
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment