[FIX] Add missing gas used validation (#740)

This commit is contained in:
KonradStaniec 2021-06-30 11:42:55 +02:00 committed by GitHub
parent 02afb27e47
commit 32e57a6aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -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")