Total difficulty can be huge on Gnosis (#7149)

This fixes the following issue observed on gnosis_withdrawals_devnet_2:
```
[DBUG] [03-21|09:24:15.060] Handling incoming message                stream=RecvMessage err="newBlock66: too large block TD: bitlen 144"
```
This commit is contained in:
Andrew Ashikhmin 2023-03-21 10:38:06 +01:00 committed by GitHub
parent 00b1df6f3a
commit 4087510c2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -394,15 +394,7 @@ func (nbp *NewBlockPacket) DecodeRLP(s *rlp.Stream) error {
// SanityCheck verifies that the values are reasonable, as a DoS protection
func (request *NewBlockPacket) SanityCheck() error {
if err := request.Block.SanityCheck(); err != nil {
return err
}
//TD at mainnet block #7753254 is 76 bits. If it becomes 100 million times
// larger, it will still fit within 100 bits
if tdLen := request.TD.BitLen(); tdLen > 100 {
return fmt.Errorf("too large block TD: bitlen %d", tdLen)
}
return nil
return request.Block.SanityCheck()
}
// GetBlockBodiesPacket represents a block body query.