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
b1113aa0
Unverified
Commit
b1113aa0
authored
Apr 25, 2023
by
Sina Mahmoodi
Committed by
GitHub
Apr 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: fix crash on querying finalized block (#27162)
eth: fix crash on querying nil finalized block
parent
2f98dd38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
api_backend.go
eth/api_backend.go
+6
-0
No files found.
eth/api_backend.go
View file @
b1113aa0
...
@@ -134,6 +134,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
...
@@ -134,6 +134,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
return
nil
,
errors
.
New
(
"'finalized' tag not supported on pre-merge network"
)
return
nil
,
errors
.
New
(
"'finalized' tag not supported on pre-merge network"
)
}
}
header
:=
b
.
eth
.
blockchain
.
CurrentFinalBlock
()
header
:=
b
.
eth
.
blockchain
.
CurrentFinalBlock
()
if
header
==
nil
{
return
nil
,
errors
.
New
(
"finalized block not found"
)
}
return
b
.
eth
.
blockchain
.
GetBlock
(
header
.
Hash
(),
header
.
Number
.
Uint64
()),
nil
return
b
.
eth
.
blockchain
.
GetBlock
(
header
.
Hash
(),
header
.
Number
.
Uint64
()),
nil
}
}
if
number
==
rpc
.
SafeBlockNumber
{
if
number
==
rpc
.
SafeBlockNumber
{
...
@@ -141,6 +144,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
...
@@ -141,6 +144,9 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
return
nil
,
errors
.
New
(
"'safe' tag not supported on pre-merge network"
)
return
nil
,
errors
.
New
(
"'safe' tag not supported on pre-merge network"
)
}
}
header
:=
b
.
eth
.
blockchain
.
CurrentSafeBlock
()
header
:=
b
.
eth
.
blockchain
.
CurrentSafeBlock
()
if
header
==
nil
{
return
nil
,
errors
.
New
(
"safe block not found"
)
}
return
b
.
eth
.
blockchain
.
GetBlock
(
header
.
Hash
(),
header
.
Number
.
Uint64
()),
nil
return
b
.
eth
.
blockchain
.
GetBlock
(
header
.
Hash
(),
header
.
Number
.
Uint64
()),
nil
}
}
return
b
.
eth
.
blockchain
.
GetBlockByNumber
(
uint64
(
number
)),
nil
return
b
.
eth
.
blockchain
.
GetBlockByNumber
(
uint64
(
number
)),
nil
...
...
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