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
dcffb777
Unverified
Commit
dcffb777
authored
Feb 11, 2020
by
winsvega
Committed by
GitHub
Feb 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/geth retesteth: add eth_getBlockByHash (#20621)
parent
8694d14e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
retesteth.go
cmd/geth/retesteth.go
+15
-0
No files found.
cmd/geth/retesteth.go
View file @
dcffb777
...
...
@@ -80,6 +80,7 @@ type RetestethEthAPI interface {
SendRawTransaction
(
ctx
context
.
Context
,
rawTx
hexutil
.
Bytes
)
(
common
.
Hash
,
error
)
BlockNumber
(
ctx
context
.
Context
)
(
uint64
,
error
)
GetBlockByNumber
(
ctx
context
.
Context
,
blockNr
math
.
HexOrDecimal64
,
fullTx
bool
)
(
map
[
string
]
interface
{},
error
)
GetBlockByHash
(
ctx
context
.
Context
,
blockHash
common
.
Hash
,
fullTx
bool
)
(
map
[
string
]
interface
{},
error
)
GetBalance
(
ctx
context
.
Context
,
address
common
.
Address
,
blockNr
math
.
HexOrDecimal64
)
(
*
math
.
HexOrDecimal256
,
error
)
GetCode
(
ctx
context
.
Context
,
address
common
.
Address
,
blockNr
math
.
HexOrDecimal64
)
(
hexutil
.
Bytes
,
error
)
GetTransactionCount
(
ctx
context
.
Context
,
address
common
.
Address
,
blockNr
math
.
HexOrDecimal64
)
(
uint64
,
error
)
...
...
@@ -618,6 +619,20 @@ func (api *RetestethAPI) GetBlockByNumber(ctx context.Context, blockNr math.HexO
return
nil
,
fmt
.
Errorf
(
"block %d not found"
,
blockNr
)
}
func
(
api
*
RetestethAPI
)
GetBlockByHash
(
ctx
context
.
Context
,
blockHash
common
.
Hash
,
fullTx
bool
)
(
map
[
string
]
interface
{},
error
)
{
block
:=
api
.
blockchain
.
GetBlockByHash
(
blockHash
)
if
block
!=
nil
{
response
,
err
:=
RPCMarshalBlock
(
block
,
true
,
fullTx
)
if
err
!=
nil
{
return
nil
,
err
}
response
[
"author"
]
=
response
[
"miner"
]
response
[
"totalDifficulty"
]
=
(
*
hexutil
.
Big
)(
api
.
blockchain
.
GetTd
(
block
.
Hash
(),
block
.
Number
()
.
Uint64
()))
return
response
,
err
}
return
nil
,
fmt
.
Errorf
(
"block 0x%x not found"
,
blockHash
)
}
func
(
api
*
RetestethAPI
)
AccountRange
(
ctx
context
.
Context
,
blockHashOrNumber
*
math
.
HexOrDecimal256
,
txIndex
uint64
,
addressHash
*
math
.
HexOrDecimal256
,
maxResults
uint64
,
...
...
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