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
df52967f
Unverified
Commit
df52967f
authored
Jan 27, 2023
by
Felix Lange
Committed by
GitHub
Jan 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/catalyst: fix panic in TestWithdrawals (#26563)
Fixes a regression introduced in #26549
parent
90f15a02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
api.go
eth/catalyst/api.go
+15
-7
No files found.
eth/catalyst/api.go
View file @
df52967f
...
...
@@ -175,19 +175,27 @@ func (api *ConsensusAPI) ForkchoiceUpdatedV1(update beacon.ForkchoiceStateV1, pa
// ForkchoiceUpdatedV2 is equivalent to V1 with the addition of withdrawals in the payload attributes.
func
(
api
*
ConsensusAPI
)
ForkchoiceUpdatedV2
(
update
beacon
.
ForkchoiceStateV1
,
payloadAttributes
*
beacon
.
PayloadAttributes
)
(
beacon
.
ForkChoiceResponse
,
error
)
{
if
!
api
.
eth
.
BlockChain
()
.
Config
()
.
IsShanghai
(
payloadAttributes
.
Timestamp
)
{
if
payloadAttributes
!=
nil
{
if
err
:=
api
.
verifyPayloadAttributes
(
payloadAttributes
);
err
!=
nil
{
return
beacon
.
STATUS_INVALID
,
beacon
.
InvalidPayloadAttributes
.
With
(
err
)
}
}
return
api
.
forkchoiceUpdated
(
update
,
payloadAttributes
)
}
func
(
api
*
ConsensusAPI
)
verifyPayloadAttributes
(
attr
*
beacon
.
PayloadAttributes
)
error
{
if
!
api
.
eth
.
BlockChain
()
.
Config
()
.
IsShanghai
(
attr
.
Timestamp
)
{
// Reject payload attributes with withdrawals before shanghai
if
payloadAttributes
!=
nil
&&
payloadAttributes
.
Withdrawals
!=
nil
{
return
beacon
.
STATUS_INVALID
,
beacon
.
InvalidPayloadAttributes
.
With
(
errors
.
New
(
"withdrawals before shanghai"
)
)
if
attr
.
Withdrawals
!=
nil
{
return
errors
.
New
(
"withdrawals before shanghai"
)
}
}
else
{
// Reject payload attributes with nil withdrawals after shanghai
if
payloadAttributes
!=
nil
&&
payloadAttributes
.
Withdrawals
==
nil
{
return
beacon
.
STATUS_INVALID
,
beacon
.
InvalidPayloadAttributes
.
With
(
errors
.
New
(
"missing withdrawals list"
)
)
if
attr
.
Withdrawals
==
nil
{
return
errors
.
New
(
"missing withdrawals list"
)
}
}
return
api
.
forkchoiceUpdated
(
update
,
payloadAttributes
)
return
nil
}
func
(
api
*
ConsensusAPI
)
forkchoiceUpdated
(
update
beacon
.
ForkchoiceStateV1
,
payloadAttributes
*
beacon
.
PayloadAttributes
)
(
beacon
.
ForkChoiceResponse
,
error
)
{
...
...
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