Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix txpool underpriced check #964

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
0xmountaintop marked this conversation as resolved.
Show resolved Hide resolved
log.Trace("Discarding underpriced transaction", "hash", hash, "gasTipCap", tx.GasTipCap(), "gasFeeCap", tx.GasFeeCap(), "txPoolGasTip", pool.gasTip.Load())
colinlyguo marked this conversation as resolved.
Show resolved Hide resolved
underpricedTxMeter.Mark(1)
return false, txpool.ErrUnderpriced
}
Expand Down
4 changes: 2 additions & 2 deletions core/txpool/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading