mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 02:49:55 +00:00
chore: clippy
This commit is contained in:
@ -147,7 +147,7 @@ impl<Eth: EthWrapper> EthFilterApiServer<RpcTransaction<Eth::NetworkTypes>>
|
|||||||
transactions
|
transactions
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|tx| tx.is_system_transaction())
|
.filter(|tx| tx.is_system_transaction())
|
||||||
.map(|tx| tx.tx_hash().clone())
|
.map(|tx| *tx.tx_hash())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
@ -216,12 +216,10 @@ impl<Eth: EthWrapper> EthPubSubApiServer<RpcTransaction<Eth::NetworkTypes>>
|
|||||||
fn not_from_system_tx<Eth: EthWrapper>(log: &Log, provider: &Eth::Provider) -> bool {
|
fn not_from_system_tx<Eth: EthWrapper>(log: &Log, provider: &Eth::Provider) -> bool {
|
||||||
let block = provider.block_by_number(log.block_number.unwrap()).unwrap().unwrap();
|
let block = provider.block_by_number(log.block_number.unwrap()).unwrap().unwrap();
|
||||||
let transactions = block.body.transactions().collect::<Vec<_>>();
|
let transactions = block.body.transactions().collect::<Vec<_>>();
|
||||||
transactions
|
!transactions
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|tx| tx.is_system_transaction())
|
.filter(|tx| tx.is_system_transaction())
|
||||||
.map(|tx| tx.tx_hash().clone())
|
.map(|tx| *tx.tx_hash()).any(|tx_hash| tx_hash == log.transaction_hash.unwrap())
|
||||||
.find(|tx_hash| tx_hash == &log.transaction_hash.unwrap())
|
|
||||||
.is_none()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper to convert a serde error into an [`ErrorObject`]
|
/// Helper to convert a serde error into an [`ErrorObject`]
|
||||||
|
|||||||
@ -145,7 +145,7 @@ where
|
|||||||
|
|
||||||
if let Some(recovered_block) = recovered_block {
|
if let Some(recovered_block) = recovered_block {
|
||||||
let recovered_block = if hl_node_compliant {
|
let recovered_block = if hl_node_compliant {
|
||||||
filter_if_hl_node_compliant(&*recovered_block)
|
filter_if_hl_node_compliant(&recovered_block)
|
||||||
} else {
|
} else {
|
||||||
(*recovered_block).clone()
|
(*recovered_block).clone()
|
||||||
};
|
};
|
||||||
@ -167,7 +167,7 @@ fn filter_if_hl_node_compliant(
|
|||||||
.position(|tx| !tx.is_system_transaction())
|
.position(|tx| !tx.is_system_transaction())
|
||||||
.unwrap_or(transactions.len());
|
.unwrap_or(transactions.len());
|
||||||
|
|
||||||
let mut new_block: HlBlock = sealed_block.clone_block().into();
|
let mut new_block: HlBlock = sealed_block.clone_block();
|
||||||
new_block.body.transactions.drain(..to_skip);
|
new_block.body.transactions.drain(..to_skip);
|
||||||
let new_sealed_block = SealedBlock::new_unchecked(new_block, sealed_block.hash());
|
let new_sealed_block = SealedBlock::new_unchecked(new_block, sealed_block.hash());
|
||||||
let new_senders = recovered_block.senders()[to_skip..].to_vec();
|
let new_senders = recovered_block.senders()[to_skip..].to_vec();
|
||||||
|
|||||||
@ -258,19 +258,13 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Builds [`HlEthApi`] for HL.
|
/// Builds [`HlEthApi`] for HL.
|
||||||
#[derive(Debug)]
|
#[derive(Debug, Default)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct HlEthApiBuilder {
|
pub struct HlEthApiBuilder {
|
||||||
/// Whether the node is in HL node compliant mode.
|
/// Whether the node is in HL node compliant mode.
|
||||||
pub(crate) hl_node_compliant: bool,
|
pub(crate) hl_node_compliant: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HlEthApiBuilder {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self { hl_node_compliant: false }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<N> EthApiBuilder<N> for HlEthApiBuilder
|
impl<N> EthApiBuilder<N> for HlEthApiBuilder
|
||||||
where
|
where
|
||||||
N: FullNodeComponents,
|
N: FullNodeComponents,
|
||||||
|
|||||||
Reference in New Issue
Block a user