mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
fix txpool underpriced check (#964)
* fix txpool underpriced check * Update core/txpool/legacypool/legacypool.go Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com> --------- Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
This commit is contained in:
parent
2f828ecdb3
commit
763bc05eba
2 changed files with 5 additions and 4 deletions
|
|
@ -746,8 +746,9 @@ func (pool *LegacyPool) add(tx *types.Transaction, local bool) (replaced bool, e
|
|||
// If the transaction pool is full, discard underpriced transactions
|
||||
if uint64(pool.all.Slots()+numSlots(tx)) > pool.config.GlobalSlots+pool.config.GlobalQueue {
|
||||
// If the new transaction is underpriced, don't accept it
|
||||
if !isLocal && pool.priced.Underpriced(tx) {
|
||||
log.Trace("Discarding underpriced transaction", "hash", hash, "gasTipCap", tx.GasTipCap(), "gasFeeCap", tx.GasFeeCap())
|
||||
// if !isLocal && pool.priced.Underpriced(tx) {
|
||||
if !isLocal && tx.GasFeeCapIntCmp(pool.gasTip.Load()) < 0 {
|
||||
log.Trace("Discarding underpriced transaction", "hash", hash, "gasTipCap", tx.GasTipCap(), "gasFeeCap", tx.GasFeeCap(), "txPoolGasTip", pool.gasTip.Load())
|
||||
underpricedTxMeter.Mark(1)
|
||||
return false, txpool.ErrUnderpriced
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
|||
}
|
||||
// Ensure the gasprice is high enough to cover the requirement of the calling
|
||||
// pool and/or block producer
|
||||
if tx.GasTipCapIntCmp(opts.MinTip) < 0 {
|
||||
return fmt.Errorf("%w: tip needed %v, tip permitted %v", ErrUnderpriced, opts.MinTip, tx.GasTipCap())
|
||||
if tx.GasFeeCapIntCmp(opts.MinTip) < 0 {
|
||||
return fmt.Errorf("%w: fee needed %v, fee permitted %v", ErrUnderpriced, opts.MinTip, tx.GasFeeCap())
|
||||
}
|
||||
// Ensure blob transactions have valid commitments
|
||||
if tx.Type() == types.BlobTxType {
|
||||
|
|
|
|||
Loading…
Reference in a new issue