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
45a660a4
Unverified
Commit
45a660a4
authored
Aug 23, 2022
by
Martin Holst Swende
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consensus/beacon: don't ignore errors
parent
6d711f0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
consensus.go
consensus/beacon/consensus.go
+9
-3
No files found.
consensus/beacon/consensus.go
View file @
45a660a4
...
@@ -79,7 +79,10 @@ func (beacon *Beacon) Author(header *types.Header) (common.Address, error) {
...
@@ -79,7 +79,10 @@ func (beacon *Beacon) Author(header *types.Header) (common.Address, error) {
// VerifyHeader checks whether a header conforms to the consensus rules of the
// VerifyHeader checks whether a header conforms to the consensus rules of the
// stock Ethereum consensus engine.
// stock Ethereum consensus engine.
func
(
beacon
*
Beacon
)
VerifyHeader
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
,
seal
bool
)
error
{
func
(
beacon
*
Beacon
)
VerifyHeader
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
,
seal
bool
)
error
{
reached
,
_
:=
IsTTDReached
(
chain
,
header
.
ParentHash
,
header
.
Number
.
Uint64
()
-
1
)
reached
,
err
:=
IsTTDReached
(
chain
,
header
.
ParentHash
,
header
.
Number
.
Uint64
()
-
1
)
if
err
!=
nil
{
return
err
}
if
!
reached
{
if
!
reached
{
return
beacon
.
ethone
.
VerifyHeader
(
chain
,
header
,
seal
)
return
beacon
.
ethone
.
VerifyHeader
(
chain
,
header
,
seal
)
}
}
...
@@ -116,11 +119,14 @@ func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers [
...
@@ -116,11 +119,14 @@ func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers [
if
len
(
preHeaders
)
==
0
{
if
len
(
preHeaders
)
==
0
{
// All the headers are pos headers. Verify that the parent block reached total terminal difficulty.
// All the headers are pos headers. Verify that the parent block reached total terminal difficulty.
if
reached
,
_
:=
IsTTDReached
(
chain
,
headers
[
0
]
.
ParentHash
,
headers
[
0
]
.
Number
.
Uint64
()
-
1
);
!
reached
{
if
reached
,
err
:=
IsTTDReached
(
chain
,
headers
[
0
]
.
ParentHash
,
headers
[
0
]
.
Number
.
Uint64
()
-
1
);
!
reached
{
// TTD not reached for the first block, mark subsequent with invalid terminal block
// TTD not reached for the first block, mark subsequent with invalid terminal block
if
err
==
nil
{
err
=
consensus
.
ErrInvalidTerminalBlock
}
results
:=
make
(
chan
error
,
len
(
headers
))
results
:=
make
(
chan
error
,
len
(
headers
))
for
i
:=
0
;
i
<
len
(
headers
);
i
++
{
for
i
:=
0
;
i
<
len
(
headers
);
i
++
{
results
<-
consensus
.
ErrInvalidTerminalBlock
results
<-
err
}
}
return
make
(
chan
struct
{}),
results
return
make
(
chan
struct
{}),
results
}
}
...
...
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