Commit 27290e12 authored by obscuren's avatar obscuren

Fixed gas limit calculation

parent c51db4c9
...@@ -130,8 +130,10 @@ func (block *Block) CalcGasLimit(parent *Block) *big.Int { ...@@ -130,8 +130,10 @@ func (block *Block) CalcGasLimit(parent *Block) *big.Int {
return ethutil.BigPow(10, 6) return ethutil.BigPow(10, 6)
} }
previous := new(big.Int).Mul(big.NewInt(1023), parent.GasLimit) // ((1024-1) * parent.gasLimit + (gasUsed * 6 / 5)) / 1024
current := new(big.Rat).Mul(new(big.Rat).SetInt(block.GasUsed), big.NewRat(6, 5))
previous := new(big.Int).Mul(big.NewInt(1024-1), parent.GasLimit)
current := new(big.Rat).Mul(new(big.Rat).SetInt(parent.GasUsed), big.NewRat(6, 5))
curInt := new(big.Int).Div(current.Num(), current.Denom()) curInt := new(big.Int).Div(current.Num(), current.Denom())
result := new(big.Int).Add(previous, curInt) result := new(big.Int).Add(previous, curInt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment