small fixes

This commit is contained in:
sunce86 2021-08-01 21:12:52 +02:00 committed by POA
parent 79be8f1ab8
commit 8bb02dd479
2 changed files with 6 additions and 6 deletions

View File

@ -1955,7 +1955,7 @@ impl Call for Client {
gas_used: U256::default(),
gas_limit: U256::max_value(),
//if gas pricing is not defined, force base_fee to zero
base_fee: if transaction.effective_gas_price(header.base_fee()) == 0.into() {
base_fee: if transaction.effective_gas_price(header.base_fee()).is_zero() {
Some(0.into())
} else {
header.base_fee()
@ -1988,7 +1988,7 @@ impl Call for Client {
for &(ref t, analytics) in transactions {
//if gas pricing is not defined, force base_fee to zero
if t.effective_gas_price(header.base_fee()) == 0.into() {
if t.effective_gas_price(header.base_fee()).is_zero() {
env_info.base_fee = Some(0.into());
} else {
env_info.base_fee = header.base_fee()
@ -2020,7 +2020,7 @@ impl Call for Client {
last_hashes: self.build_last_hashes(header.parent_hash()),
gas_used: U256::default(),
gas_limit: max,
base_fee: if t.effective_gas_price(header.base_fee()) == 0.into() {
base_fee: if t.effective_gas_price(header.base_fee()).is_zero() {
Some(0.into())
} else {
header.base_fee()

View File

@ -660,10 +660,10 @@ impl TypedTransaction {
pub fn is_service(&self) -> bool {
match self {
Self::EIP1559Transaction(tx) => {
tx.tx().gas_price == 0.into() && tx.max_priority_fee_per_gas == 0.into()
tx.tx().gas_price.is_zero() && tx.max_priority_fee_per_gas.is_zero()
}
Self::AccessList(tx) => tx.tx().gas_price == 0.into(),
Self::Legacy(tx) => tx.gas_price == 0.into(),
Self::AccessList(tx) => tx.tx().gas_price.is_zero(),
Self::Legacy(tx) => tx.gas_price.is_zero(),
}
}