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

Fix block period changing down #1564

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion consensus/istanbul/ibft/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func (e *Engine) verifyCascadingFields(chain consensus.ChainHeaderReader, header
}

// Ensure that the block's timestamp isn't too close to it's parent
if parent.Time+e.cfg.GetConfig(parent.Number).BlockPeriod > header.Time {
if parent.Time+e.cfg.GetConfig(header.Number).BlockPeriod > header.Time {
return istanbulcommon.ErrInvalidTimestamp
}

Expand Down
4 changes: 3 additions & 1 deletion consensus/istanbul/qbft/engine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ func (e *Engine) verifyCascadingFields(chain consensus.ChainHeaderReader, header
}

// Ensure that the block's timestamp isn't too close to it's parent
if parent.Time+e.cfg.GetConfig(parent.Number).BlockPeriod > header.Time {
// When the BlockPeriod is reduced it is reduced for the proposal.
// e.g when blockperiod is 1 from block 10 the block period between 9 and 10 is 1
if parent.Time+e.cfg.GetConfig(header.Number).BlockPeriod > header.Time {
return istanbulcommon.ErrInvalidTimestamp
}

Expand Down