From a7102dac68a02a810d7b6c3ad36d622d68fb78b7 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 14 Jun 2019 12:11:36 +0200 Subject: [PATCH] core: remove homestead check in TxPool This change removes tracking of the homestead block number from TxPool. The homestead field was used to enforce minimum gas of 53000 for contract creations after the homestead fork, but not before it. Since nobody would want configure a non-homestead chain nowadays and contract creations usually take more than 53000 gas, the extra correctness is redundant and can be removed. --- core/tx_pool.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/tx_pool.go b/core/tx_pool.go index 9881746872..b42446b1b0 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -238,8 +238,6 @@ type TxPool struct { reorgDoneCh chan chan struct{} reorgShutdownCh chan struct{} // requests shutdown of scheduleReorgLoop wg sync.WaitGroup // tracks loop, scheduleReorgLoop - - homestead bool } type txpoolResetRequest struct { @@ -540,7 +538,8 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 { return ErrInsufficientFunds } - intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, pool.homestead) + // Ensure the transaction has more gas than the basic tx fee. + intrGas, err := IntrinsicGas(tx.Data(), tx.To() == nil, true) if err != nil { return err } @@ -979,9 +978,6 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt pool.mu.Lock() if reset != nil { - if reset.newHead != nil && pool.chainconfig.IsHomestead(reset.newHead.Number) { - pool.homestead = true - } pool.reset(reset.oldHead, reset.newHead) // Reset needs promote for all addresses. promoteAddrs = promoteAddrs[:0]