math/big: rename TTM63m1 -> MaxBig63, + go fmt

This commit is contained in:
Martin Holst Swende 2017-05-04 11:54:39 +02:00
parent 124af830ff
commit 764c2520c3
2 changed files with 6 additions and 6 deletions

View file

@ -27,8 +27,8 @@ var (
tt256 = BigPow(2, 256)
tt256m1 = new(big.Int).Sub(tt256, big.NewInt(1))
MaxBig256 = new(big.Int).Set(tt256m1)
tt63 = BigPow(2,63)
TT63m1 = new(big.Int).Sub(tt63,big.NewInt(1))
tt63 = BigPow(2, 63)
MaxBig63 = new(big.Int).Sub(tt63, big.NewInt(1))
)
const (

View file

@ -244,11 +244,11 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainReader, header, parent *
return fmt.Errorf("invalid difficulty: have %v, want %v", header.Difficulty, expected)
}
// Verify that the gas limit is < 2^63-1
if header.GasLimit.Cmp(math.TT63m1) > 0{
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, math.TT63m1)
if header.GasLimit.Cmp(math.MaxBig63) > 0 {
return fmt.Errorf("invalid gasLimit: have %v, max %v", header.GasLimit, math.MaxBig63)
}
// Verify that the gasUsed is <= gasLimit
if header.GasUsed.Cmp(header.GasLimit) > 0{
if header.GasUsed.Cmp(header.GasLimit) > 0 {
return fmt.Errorf("invalid gasUsed: have %v, gasLimit %v", header.GasUsed, header.GasLimit)
}