Fix MinGasPrice config option

This commit is contained in:
POA 2021-09-28 13:54:20 +03:00
parent 3413343caa
commit 74e709fd55
3 changed files with 16 additions and 6 deletions

View File

@ -317,9 +317,10 @@ impl<C: Client> txpool::Verifier<Transaction>
let sender = transaction.sender(); let sender = transaction.sender();
let account_details = self.client.account_details(&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); let transaction_type = self.client.transaction_type(&transaction);
if let TransactionType::Service = transaction_type { if let TransactionType::Service = transaction_type {
debug!(target: "txqueue", "Service tx {:?} below minimal gas price accepted", hash); debug!(target: "txqueue", "Service tx {:?} below minimal gas price accepted", hash);
@ -330,16 +331,18 @@ impl<C: Client> txpool::Verifier<Transaction>
target: "txqueue", target: "txqueue",
"[{:?}] Rejected tx below minimal gas price threshold: {} < {}", "[{:?}] Rejected tx below minimal gas price threshold: {} < {}",
hash, hash,
gas_price, effective_priority_fee,
self.options.minimal_gas_price, self.options.minimal_gas_price,
); );
bail!(transaction::Error::InsufficientGasPrice { bail!(transaction::Error::InsufficientGasPrice {
minimal: self.options.minimal_gas_price, 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() { if gas_price < transaction.max_priority_fee_per_gas() {
bail!(transaction::Error::InsufficientGasPrice { bail!(transaction::Error::InsufficientGasPrice {
minimal: transaction.max_priority_fee_per_gas(), minimal: transaction.max_priority_fee_per_gas(),

View File

@ -650,7 +650,9 @@ where
match self.ready.is_ready(&tx) { match self.ready.is_ready(&tx) {
Readiness::Ready => { Readiness::Ready => {
//return transaction with score higher or equal to desired //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()); return Some(tx.transaction.clone());
} }
} }
@ -737,7 +739,9 @@ where
if tx_state == Readiness::Ready { if tx_state == Readiness::Ready {
//return transaction with score higher or equal to desired //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); return Some(best.transaction.transaction);
} }
} }

View File

@ -50,6 +50,9 @@ impl VerifiedTransaction for Transaction {
fn sender(&self) -> &Address { fn sender(&self) -> &Address {
&self.sender &self.sender
} }
fn is_service(&self) -> bool {
false
}
} }
pub type SharedTransaction = Arc<Transaction>; pub type SharedTransaction = Arc<Transaction>;