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.
This commit is contained in:
Felix Lange 2019-06-14 12:11:36 +02:00 committed by Péter Szilágyi
parent 9c9160700b
commit a7102dac68
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D

View file

@ -238,8 +238,6 @@ type TxPool struct {
reorgDoneCh chan chan struct{} reorgDoneCh chan chan struct{}
reorgShutdownCh chan struct{} // requests shutdown of scheduleReorgLoop reorgShutdownCh chan struct{} // requests shutdown of scheduleReorgLoop
wg sync.WaitGroup // tracks loop, scheduleReorgLoop wg sync.WaitGroup // tracks loop, scheduleReorgLoop
homestead bool
} }
type txpoolResetRequest struct { 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 { if pool.currentState.GetBalance(from).Cmp(tx.Cost()) < 0 {
return ErrInsufficientFunds 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 { if err != nil {
return err return err
} }
@ -979,9 +978,6 @@ func (pool *TxPool) runReorg(done chan struct{}, reset *txpoolResetRequest, dirt
pool.mu.Lock() pool.mu.Lock()
if reset != nil { if reset != nil {
if reset.newHead != nil && pool.chainconfig.IsHomestead(reset.newHead.Number) {
pool.homestead = true
}
pool.reset(reset.oldHead, reset.newHead) pool.reset(reset.oldHead, reset.newHead)
// Reset needs promote for all addresses. // Reset needs promote for all addresses.
promoteAddrs = promoteAddrs[:0] promoteAddrs = promoteAddrs[:0]