Return difficulty check into bor header validation (#8815)

This commit is contained in:
ledgerwatch 2023-11-23 16:30:58 +00:00 committed by GitHub
parent 23f23bc971
commit 19451ac610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,6 +171,10 @@ func (s *Snapshot) Apply(parent *types.Header, headers []*types.Header, logger l
if parent != nil && header.Time < parent.Time+CalcProducerDelay(number, succession, s.config) {
return snap, &BlockTooSoonError{number, succession}
}
difficulty := snap.Difficulty(signer)
if header.Difficulty.Uint64() != difficulty {
return snap, &WrongDifficultyError{number, difficulty, header.Difficulty.Uint64(), signer.Bytes()}
}
// change validator set and change proposer
if number > 0 && (number+1)%sprintLen == 0 {