core, core/state: move gas tracking out of core/state
The amount of gas available for tx execution was tracked in the StateObject representing the coinbase account. This commit makes the gas counter a separate type in package core, which avoids unintended consequences of intertwining the counter with state logic.
This commit is contained in:
@ -188,3 +188,16 @@ func IsBadHashError(err error) bool {
|
||||
_, ok := err.(BadHashError)
|
||||
return ok
|
||||
}
|
||||
|
||||
type GasLimitErr struct {
|
||||
Have, Want *big.Int
|
||||
}
|
||||
|
||||
func IsGasLimitErr(err error) bool {
|
||||
_, ok := err.(*GasLimitErr)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err *GasLimitErr) Error() string {
|
||||
return fmt.Sprintf("GasLimit reached. Have %d gas, transaction requires %d", err.Have, err.Want)
|
||||
}
|
||||
|
Reference in New Issue
Block a user