mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
Merge branch 'upstream_merge_v1.15.11' of https://github.com/maticnetwork/bor into v2.1.0-candidate
This commit is contained in:
commit
94738bb96c
1 changed files with 10 additions and 3 deletions
|
|
@ -1187,18 +1187,25 @@ func (c *Bor) checkAndCommitSpan(
|
|||
}
|
||||
|
||||
func (c *Bor) needToCommitSpan(currentSpan *span.Span, headerNumber uint64) bool {
|
||||
// if span is nil
|
||||
// If span is nil, return false.
|
||||
if currentSpan == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
// check span is not set initially
|
||||
// Check if span is not set initially, we commit the span with spanId 1, which will also commit the 0th span.
|
||||
// Check: https://github.com/maticnetwork/genesis-contracts/blob/5dcbcc72f10ab847276586e629f96b8a6d369e1d/contracts/BorValidatorSet.template#L229
|
||||
if currentSpan.EndBlock == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
// if current block is first block of last sprint in current span
|
||||
// If the current block is the first block of the last sprint in the current span.
|
||||
// But here we should skip the check for the 0th span, as it will cause the span to be committed to be committed twice.
|
||||
if currentSpan.EndBlock > c.config.CalculateSprint(headerNumber) && currentSpan.EndBlock-c.config.CalculateSprint(headerNumber)+1 == headerNumber {
|
||||
if currentSpan.ID == 0 {
|
||||
// If the current span is the 0th span, we will skip committing the span.
|
||||
log.Info("Skipping the last sprint commit for 0th span", "spanID", currentSpan.ID, "headerNumber", headerNumber)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue