Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consensus/beacon: check ttd reached on pos blocks #25552

Merged
merged 3 commits into from
Aug 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
consensus/beacon: check ttd reached on pos blocks
  • Loading branch information
MariusVanDerWijden committed Aug 19, 2022
commit 1ad0a02932574c6dfdf7721ae877d0c8bee01b40
10 changes: 10 additions & 0 deletions consensus/beacon/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ func (beacon *Beacon) VerifyHeaders(chain consensus.ChainHeaderReader, headers [

// All the headers have passed the transition point, use new rules.
if len(preHeaders) == 0 {
if reached, _ := IsTTDReached(chain, headers[0].ParentHash, headers[0].Number.Uint64()-1); !reached {
// TTD not reached for the first block, mark subsequent with invalid terminal block
results := make(chan error, len(headers))
go func() {
for i := 0; i < len(headers); i++ {
results <- consensus.ErrInvalidTerminalBlock
}
}()
return make(chan struct{}), results
}
return beacon.verifyHeaders(chain, headers, nil)
}

Expand Down