Add service transactions support for EIP-1559
This commit is contained in:
parent
8bb02dd479
commit
3413343caa
@ -188,6 +188,10 @@ impl txpool::VerifiedTransaction for VerifiedTransaction {
|
|||||||
fn sender(&self) -> &Address {
|
fn sender(&self) -> &Address {
|
||||||
&self.sender
|
&self.sender
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_service(&self) -> bool {
|
||||||
|
self.transaction.is_service()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ScoredTransaction for VerifiedTransaction {
|
impl ScoredTransaction for VerifiedTransaction {
|
||||||
|
@ -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
|
// 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 {
|
return Err(ExecutionError::GasPriceLowerThanBaseFee {
|
||||||
gas_price: t.tx().gas_price,
|
gas_price: t.tx().gas_price,
|
||||||
base_fee: self.info.base_fee.unwrap_or_default(),
|
base_fee: self.info.base_fee.unwrap_or_default(),
|
||||||
|
@ -376,7 +376,7 @@ impl EthereumMachine {
|
|||||||
header: &Header,
|
header: &Header,
|
||||||
) -> Result<SignedTransaction, transaction::Error> {
|
) -> Result<SignedTransaction, transaction::Error> {
|
||||||
// ensure that the user was willing to at least pay the base fee
|
// 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 {
|
return Err(transaction::Error::GasPriceLowerThanBaseFee {
|
||||||
gas_price: t.tx().gas_price,
|
gas_price: t.tx().gas_price,
|
||||||
base_fee: header.base_fee().unwrap_or_default(),
|
base_fee: header.base_fee().unwrap_or_default(),
|
||||||
|
@ -113,4 +113,7 @@ pub trait VerifiedTransaction: fmt::Debug {
|
|||||||
|
|
||||||
/// Transaction sender
|
/// Transaction sender
|
||||||
fn sender(&self) -> &Self::Sender;
|
fn sender(&self) -> &Self::Sender;
|
||||||
|
|
||||||
|
/// Is it a service transaction?
|
||||||
|
fn is_service(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
@ -650,7 +650,7 @@ 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 {
|
if score >= &self.includable_boundary || tx.transaction.is_service() {
|
||||||
return Some(tx.transaction.clone());
|
return Some(tx.transaction.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -737,7 +737,7 @@ 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 {
|
if best.score >= self.includable_boundary || best.transaction.transaction.is_service() {
|
||||||
return Some(best.transaction.transaction);
|
return Some(best.transaction.transaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user