diff options
author | Felix Lange <fjl@twurst.com> | 2015-09-02 18:55:11 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-10-17 16:24:34 +0800 |
commit | de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608 (patch) | |
tree | 59930f3d627940e1b73030ee2c5685104a04ee34 /core/error.go | |
parent | 10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0 (diff) | |
download | go-tangerine-de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608.tar go-tangerine-de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608.tar.gz go-tangerine-de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608.tar.bz2 go-tangerine-de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608.tar.lz go-tangerine-de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608.tar.xz go-tangerine-de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608.tar.zst go-tangerine-de8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608.zip |
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.
Diffstat (limited to 'core/error.go')
-rw-r--r-- | core/error.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/error.go b/core/error.go index 5e32124a7..6498194cd 100644 --- a/core/error.go +++ b/core/error.go @@ -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) +} |