Skip to content

Commit

Permalink
core, params: drop underpriced transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
sadoci authored and MetadiumRelease committed Sep 23, 2022
1 parent 548c814 commit 3763ee7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
if !local && tx.GasTipCapIntCmp(pool.gasPrice) < 0 {
return ErrUnderpriced
}
// Drop transactions if given fees are less than maxPriorityFeePerGas + baseFee
if params.DropUnderPriced && local && tx.EffectiveGasTipIntCmp(pool.gasPrice, pool.priced.urgent.baseFee) < 0 {
return ErrUnderpriced
}
// Ensure the transaction adheres to nonce ordering
if pool.currentState.GetNonce(from) > tx.Nonce() {
return ErrNonceTooLow
Expand Down
2 changes: 2 additions & 0 deletions core/tx_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func init() {
eip1559Config = &cpy
eip1559Config.BerlinBlock = common.Big0
eip1559Config.LondonBlock = common.Big0

params.DropUnderpriced = false
}

type testBlockChain struct {
Expand Down
1 change: 1 addition & 0 deletions params/protocol_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ var (
FixedGasLimit uint64 = 0x10000000 // 0 means no fixed gas limit
MaxIdleBlockInterval uint64 = 600 // in seconds
BlocksPerTurn uint64 = 100
DropUnderPriced bool = true // drop underpriced transactions

NonceLimit uint64 = 0 // nonce limit for non-governing accounts
UseRocksDb int = 1 // LevelDB (0) or RocksDB (1)
Expand Down

0 comments on commit 3763ee7

Please sign in to comment.