From 6f69cdd109b1dd692b8dfb15e7c53d2051fbc946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Mon, 13 Nov 2017 13:47:27 +0200 Subject: all: switch gas limits from big.Int to uint64 --- core/tx_pool.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'core/tx_pool.go') 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 -- cgit v1.2.3