mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core: fix testcase for uncle gasUsage > gasLimit : https://github.com/ethereum/tests/blob/develop/BlockchainTests/EIP150/bcUncleHeaderValiditiy.json#L986
This commit is contained in:
parent
a8aaac7e68
commit
124af830ff
1 changed files with 5 additions and 1 deletions
|
|
@ -243,10 +243,14 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainReader, header, parent *
|
||||||
if expected.Cmp(header.Difficulty) != 0 {
|
if expected.Cmp(header.Difficulty) != 0 {
|
||||||
return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, expected)
|
return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, expected)
|
||||||
}
|
}
|
||||||
// Verify that the gas limit is < 2^63
|
// Verify that the gas limit is < 2^63-1
|
||||||
if header.GasLimit.Cmp(math.TT63m1) > 0{
|
if header.GasLimit.Cmp(math.TT63m1) > 0{
|
||||||
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, math.TT63m1)
|
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, math.TT63m1)
|
||||||
}
|
}
|
||||||
|
// Verify that the gasUsed is <= gasLimit
|
||||||
|
if header.GasUsed.Cmp(header.GasLimit) > 0{
|
||||||
|
return fmt.Errorf("invalid gasUsed: have %v, gasLimit %v", header.GasUsed, header.GasLimit)
|
||||||
|
}
|
||||||
|
|
||||||
// Verify that the gas limit remains within allowed bounds
|
// Verify that the gas limit remains within allowed bounds
|
||||||
diff := new(big.Int).Set(parent.GasLimit)
|
diff := new(big.Int).Set(parent.GasLimit)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue