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
52407250
Unverified
Commit
52407250
authored
Oct 03, 2021
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal/ethapi: make header/block rlp retrieval canonical
parent
b522f5e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
14 deletions
+6
-14
api.go
internal/ethapi/api.go
+6
-14
No files found.
internal/ethapi/api.go
View file @
52407250
...
...
@@ -1916,29 +1916,21 @@ func NewPublicDebugAPI(b Backend) *PublicDebugAPI {
}
// GetHeaderRlp retrieves the RLP encoded for of a single header.
func
(
api
*
PublicDebugAPI
)
GetHeaderRlp
(
ctx
context
.
Context
,
number
uint64
)
(
string
,
error
)
{
func
(
api
*
PublicDebugAPI
)
GetHeaderRlp
(
ctx
context
.
Context
,
number
uint64
)
(
hexutil
.
Bytes
,
error
)
{
header
,
_
:=
api
.
b
.
HeaderByNumber
(
ctx
,
rpc
.
BlockNumber
(
number
))
if
header
==
nil
{
return
""
,
fmt
.
Errorf
(
"header #%d not found"
,
number
)
return
nil
,
fmt
.
Errorf
(
"header #%d not found"
,
number
)
}
encoded
,
err
:=
rlp
.
EncodeToBytes
(
header
)
if
err
!=
nil
{
return
""
,
err
}
return
fmt
.
Sprintf
(
"%x"
,
encoded
),
nil
return
rlp
.
EncodeToBytes
(
header
)
}
// GetBlockRlp retrieves the RLP encoded for of a single block.
func
(
api
*
PublicDebugAPI
)
GetBlockRlp
(
ctx
context
.
Context
,
number
uint64
)
(
string
,
error
)
{
func
(
api
*
PublicDebugAPI
)
GetBlockRlp
(
ctx
context
.
Context
,
number
uint64
)
(
hexutil
.
Bytes
,
error
)
{
block
,
_
:=
api
.
b
.
BlockByNumber
(
ctx
,
rpc
.
BlockNumber
(
number
))
if
block
==
nil
{
return
""
,
fmt
.
Errorf
(
"block #%d not found"
,
number
)
}
encoded
,
err
:=
rlp
.
EncodeToBytes
(
block
)
if
err
!=
nil
{
return
""
,
err
return
nil
,
fmt
.
Errorf
(
"block #%d not found"
,
number
)
}
return
fmt
.
Sprintf
(
"%x"
,
encoded
),
nil
return
rlp
.
EncodeToBytes
(
block
)
}
// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the
...
...
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