From 74e709fd55633217b7c50c741abdc7acb070cc0e Mon Sep 17 00:00:00 2001 From: POA <33550681+poa@users.noreply.github.com> Date: Tue, 28 Sep 2021 13:54:20 +0300 Subject: [PATCH] Fix MinGasPrice config option --- crates/concensus/miner/src/pool/verifier.rs | 11 +++++++---- crates/transaction-pool/src/pool.rs | 8 ++++++-- crates/transaction-pool/src/tests/mod.rs | 3 +++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/crates/concensus/miner/src/pool/verifier.rs b/crates/concensus/miner/src/pool/verifier.rs index 1f08d9ce8..55f13cc86 100644 --- a/crates/concensus/miner/src/pool/verifier.rs +++ b/crates/concensus/miner/src/pool/verifier.rs @@ -317,9 +317,10 @@ impl txpool::Verifier let sender = transaction.sender(); let account_details = self.client.account_details(&sender); - let gas_price = transaction.tx().gas_price; + let effective_priority_fee = + transaction.effective_priority_fee(self.options.block_base_fee); - if gas_price < self.options.minimal_gas_price { + if effective_priority_fee < self.options.minimal_gas_price { let transaction_type = self.client.transaction_type(&transaction); if let TransactionType::Service = transaction_type { debug!(target: "txqueue", "Service tx {:?} below minimal gas price accepted", hash); @@ -330,16 +331,18 @@ impl txpool::Verifier target: "txqueue", "[{:?}] Rejected tx below minimal gas price threshold: {} < {}", hash, - gas_price, + effective_priority_fee, self.options.minimal_gas_price, ); bail!(transaction::Error::InsufficientGasPrice { minimal: self.options.minimal_gas_price, - got: gas_price, + got: effective_priority_fee, }); } } + let gas_price = transaction.tx().gas_price; + if gas_price < transaction.max_priority_fee_per_gas() { bail!(transaction::Error::InsufficientGasPrice { minimal: transaction.max_priority_fee_per_gas(), diff --git a/crates/transaction-pool/src/pool.rs b/crates/transaction-pool/src/pool.rs index 7df84cc05..bf071345c 100644 --- a/crates/transaction-pool/src/pool.rs +++ b/crates/transaction-pool/src/pool.rs @@ -650,7 +650,9 @@ where match self.ready.is_ready(&tx) { Readiness::Ready => { //return transaction with score higher or equal to desired - if score >= &self.includable_boundary || tx.transaction.is_service() { + if score >= &self.includable_boundary + || tx.transaction.is_service() + { return Some(tx.transaction.clone()); } } @@ -737,7 +739,9 @@ where if tx_state == Readiness::Ready { //return transaction with score higher or equal to desired - if best.score >= self.includable_boundary || best.transaction.transaction.is_service() { + if best.score >= self.includable_boundary + || best.transaction.transaction.is_service() + { return Some(best.transaction.transaction); } } diff --git a/crates/transaction-pool/src/tests/mod.rs b/crates/transaction-pool/src/tests/mod.rs index 5ba235d23..81f4ea95c 100644 --- a/crates/transaction-pool/src/tests/mod.rs +++ b/crates/transaction-pool/src/tests/mod.rs @@ -50,6 +50,9 @@ impl VerifiedTransaction for Transaction { fn sender(&self) -> &Address { &self.sender } + fn is_service(&self) -> bool { + false + } } pub type SharedTransaction = Arc;