diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-01-03 22:53:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-03 22:53:06 +0800 |
commit | 762f3a48a00da02fe58063cb6ce8dc2d08821f15 (patch) | |
tree | 783421f8ece4306f69cb17e515ee07c1ab4fe0eb /core/tx_pool.go | |
parent | b47285f1cf0cb475f29322ceb9fac4d7e1cfb11f (diff) | |
parent | 6f69cdd109b1dd692b8dfb15e7c53d2051fbc946 (diff) | |
download | dexon-762f3a48a00da02fe58063cb6ce8dc2d08821f15.tar dexon-762f3a48a00da02fe58063cb6ce8dc2d08821f15.tar.gz dexon-762f3a48a00da02fe58063cb6ce8dc2d08821f15.tar.bz2 dexon-762f3a48a00da02fe58063cb6ce8dc2d08821f15.tar.lz dexon-762f3a48a00da02fe58063cb6ce8dc2d08821f15.tar.xz dexon-762f3a48a00da02fe58063cb6ce8dc2d08821f15.tar.zst dexon-762f3a48a00da02fe58063cb6ce8dc2d08821f15.zip |
Merge pull request #15466 from karalabe/uint64-gas-limit
all: switch gas limits from big.Int to uint64
Diffstat (limited to 'core/tx_pool.go')
-rw-r--r-- | core/tx_pool.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/tx_pool.go b/core/tx_pool.go index dade5d09f..dc3ddc423 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -197,7 +197,7 @@ type TxPool struct { currentState *state.StateDB // Current state in the blockchain head pendingState *state.ManagedState // Pending state tracking virtual nonces - currentMaxGas *big.Int // Current gas limit for transaction caps + currentMaxGas uint64 // Current gas limit for transaction caps locals *accountSet // Set of local transaction to exempt from eviction rules journal *txJournal // Journal of local transaction to back up to disk @@ -564,7 +564,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { return ErrNegativeValue } // Ensure the transaction doesn't exceed the current block limit gas. - if pool.currentMaxGas.Cmp(tx.Gas()) < 0 { + if pool.currentMaxGas < tx.Gas() { return ErrGasLimit } // Make sure the transaction is signed properly @@ -586,8 +586,11 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 { return ErrInsufficientFunds } - intrGas := IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead) - if tx.Gas().Cmp(intrGas) < 0 { + intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead) + if err != nil { + return err + } + if tx.Gas() < intrGas { return ErrIntrinsicGas } return nil |