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
5a4eba68
Unverified
Commit
5a4eba68
authored
Jul 31, 2023
by
Shude Li
Committed by
GitHub
Jul 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: conver if-else-if chain to tagged switch (#27816)
parent
95cc7bf4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
api_debug.go
eth/api_debug.go
+10
-8
No files found.
eth/api_debug.go
View file @
5a4eba68
...
...
@@ -62,13 +62,14 @@ func (api *DebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) {
return
stateDb
.
RawDump
(
opts
),
nil
}
var
header
*
types
.
Header
if
blockNr
==
rpc
.
LatestBlockNumber
{
switch
blockNr
{
case
rpc
.
LatestBlockNumber
:
header
=
api
.
eth
.
blockchain
.
CurrentBlock
()
}
else
if
blockNr
==
rpc
.
FinalizedBlockNumber
{
case
rpc
.
FinalizedBlockNumber
:
header
=
api
.
eth
.
blockchain
.
CurrentFinalBlock
()
}
else
if
blockNr
==
rpc
.
SafeBlockNumber
{
case
rpc
.
SafeBlockNumber
:
header
=
api
.
eth
.
blockchain
.
CurrentSafeBlock
()
}
else
{
default
:
block
:=
api
.
eth
.
blockchain
.
GetBlockByNumber
(
uint64
(
blockNr
))
if
block
==
nil
{
return
state
.
Dump
{},
fmt
.
Errorf
(
"block #%d not found"
,
blockNr
)
...
...
@@ -146,13 +147,14 @@ func (api *DebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, start hex
}
}
else
{
var
header
*
types
.
Header
if
number
==
rpc
.
LatestBlockNumber
{
switch
number
{
case
rpc
.
LatestBlockNumber
:
header
=
api
.
eth
.
blockchain
.
CurrentBlock
()
}
else
if
number
==
rpc
.
FinalizedBlockNumber
{
case
rpc
.
FinalizedBlockNumber
:
header
=
api
.
eth
.
blockchain
.
CurrentFinalBlock
()
}
else
if
number
==
rpc
.
SafeBlockNumber
{
case
rpc
.
SafeBlockNumber
:
header
=
api
.
eth
.
blockchain
.
CurrentSafeBlock
()
}
else
{
default
:
block
:=
api
.
eth
.
blockchain
.
GetBlockByNumber
(
uint64
(
number
))
if
block
==
nil
{
return
state
.
IteratorDump
{},
fmt
.
Errorf
(
"block #%d not found"
,
number
)
...
...
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