Add service transactions support for EIP-1559

This commit is contained in:
POA 2021-09-24 14:53:17 +03:00
parent 8bb02dd479
commit 3413343caa
5 changed files with 11 additions and 4 deletions

View File

@ -188,6 +188,10 @@ impl txpool::VerifiedTransaction for VerifiedTransaction {
fn sender(&self) -> &Address {
&self.sender
}
fn is_service(&self) -> bool {
self.transaction.is_service()
}
}
impl ScoredTransaction for VerifiedTransaction {

View File

@ -1207,7 +1207,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
}
// ensure that the user was willing to at least pay the base fee
if t.tx().gas_price < self.info.base_fee.unwrap_or_default() {
if t.tx().gas_price < self.info.base_fee.unwrap_or_default() && !t.is_service() {
return Err(ExecutionError::GasPriceLowerThanBaseFee {
gas_price: t.tx().gas_price,
base_fee: self.info.base_fee.unwrap_or_default(),

View File

@ -376,7 +376,7 @@ impl EthereumMachine {
header: &Header,
) -> Result<SignedTransaction, transaction::Error> {
// ensure that the user was willing to at least pay the base fee
if t.tx().gas_price < header.base_fee().unwrap_or_default() {
if t.tx().gas_price < header.base_fee().unwrap_or_default() && !t.is_service() {
return Err(transaction::Error::GasPriceLowerThanBaseFee {
gas_price: t.tx().gas_price,
base_fee: header.base_fee().unwrap_or_default(),

View File

@ -113,4 +113,7 @@ pub trait VerifiedTransaction: fmt::Debug {
/// Transaction sender
fn sender(&self) -> &Self::Sender;
/// Is it a service transaction?
fn is_service(&self) -> bool;
}

View File

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