diff --git a/nimbus/p2p/validate.nim b/nimbus/p2p/validate.nim index 779f6c680..0d14b7718 100644 --- a/nimbus/p2p/validate.nim +++ b/nimbus/p2p/validate.nim @@ -180,6 +180,9 @@ proc validateHeader(db: BaseChainDB; header, parentHeader: BlockHeader; if header.gasUsed == 0 and 0 < numTransactions: return err("zero gasUsed but tranactions present"); + if header.gasUsed < 0 or header.gasUsed > header.gasLimit: + return err("gasUsed should be non negative and smaller or equal gasLimit") + if header.blockNumber != parentHeader.blockNumber + 1: return err("Blocks must be numbered consecutively")