mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
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:
parent
9c9160700b
commit
a7102dac68
1 changed files with 2 additions and 6 deletions
|
|
@ -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]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue