Skip to content

Commit

Permalink
Fix block period changing down (#1564)
Browse files Browse the repository at this point in the history
- the block proposal is responsible for changing the block period
  • Loading branch information
antonydenyer committed Nov 24, 2022
1 parent f4dd848 commit 6f81194
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
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

0 comments on commit 6f81194

Please sign in to comment.