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
01fdca53
Unverified
Commit
01fdca53
authored
Oct 3, 2021
by
Péter Szilágyi
Committed by
GitHub
Oct 3, 2021
Browse files
Options
Downloads
Plain Diff
Merge pull request #23677 from karalabe/canon-rlp-fetcher
internal/ethapi: make header/block rlp retrieval canonical
parents
b522f5e0
52407250
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
internal/ethapi/api.go
+6
-14
6 additions, 14 deletions
internal/ethapi/api.go
with
6 additions
and
14 deletions
internal/ethapi/api.go
+
6
−
14
View file @
01fdca53
...
@@ -1916,29 +1916,21 @@ func NewPublicDebugAPI(b Backend) *PublicDebugAPI {
...
@@ -1916,29 +1916,21 @@ func NewPublicDebugAPI(b Backend) *PublicDebugAPI {
}
}
// GetHeaderRlp retrieves the RLP encoded for of a single header.
// 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
))
header
,
_
:=
api
.
b
.
HeaderByNumber
(
ctx
,
rpc
.
BlockNumber
(
number
))
if
header
==
nil
{
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
)
return
rlp
.
EncodeToBytes
(
header
)
if
err
!=
nil
{
return
""
,
err
}
return
fmt
.
Sprintf
(
"%x"
,
encoded
),
nil
}
}
// GetBlockRlp retrieves the RLP encoded for of a single block.
// 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
))
block
,
_
:=
api
.
b
.
BlockByNumber
(
ctx
,
rpc
.
BlockNumber
(
number
))
if
block
==
nil
{
if
block
==
nil
{
return
""
,
fmt
.
Errorf
(
"block #%d not found"
,
number
)
return
nil
,
fmt
.
Errorf
(
"block #%d not found"
,
number
)
}
encoded
,
err
:=
rlp
.
EncodeToBytes
(
block
)
if
err
!=
nil
{
return
""
,
err
}
}
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
// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the
...
...
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