Skip to content

Commit 3763ee7

Browse files
sadociMetadiumRelease
authored andcommitted
core, params: drop underpriced transactions
1 parent 548c814 commit 3763ee7

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

core/tx_pool.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
672672
if !local && tx.GasTipCapIntCmp(pool.gasPrice) < 0 {
673673
return ErrUnderpriced
674674
}
675+
// Drop transactions if given fees are less than maxPriorityFeePerGas + baseFee
676+
if params.DropUnderPriced && local && tx.EffectiveGasTipIntCmp(pool.gasPrice, pool.priced.urgent.baseFee) < 0 {
677+
return ErrUnderpriced
678+
}
675679
// Ensure the transaction adheres to nonce ordering
676680
if pool.currentState.GetNonce(from) > tx.Nonce() {
677681
return ErrNonceTooLow

core/tx_pool_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ func init() {
5555
eip1559Config = &cpy
5656
eip1559Config.BerlinBlock = common.Big0
5757
eip1559Config.LondonBlock = common.Big0
58+
59+
params.DropUnderpriced = false
5860
}
5961

6062
type testBlockChain struct {

params/protocol_params.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ var (
186186
FixedGasLimit uint64 = 0x10000000 // 0 means no fixed gas limit
187187
MaxIdleBlockInterval uint64 = 600 // in seconds
188188
BlocksPerTurn uint64 = 100
189+
DropUnderPriced bool = true // drop underpriced transactions
189190

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

0 commit comments

Comments
 (0)