mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-27 16:18:08 -05:00
chore: rm redundant ( (#10112)
This commit is contained in:
@@ -60,7 +60,7 @@ where
|
||||
// If the receiver errors then senders have disconnected, so the loop should then end.
|
||||
while let Ok(action) = self.incoming.recv() {
|
||||
match action {
|
||||
PersistenceAction::RemoveBlocksAbove((new_tip_num, sender)) => {
|
||||
PersistenceAction::RemoveBlocksAbove(new_tip_num, sender) => {
|
||||
let provider_rw = self.provider.provider_rw()?;
|
||||
let sf_provider = self.provider.static_file_provider();
|
||||
|
||||
@@ -71,7 +71,7 @@ where
|
||||
// we ignore the error because the caller may or may not care about the result
|
||||
let _ = sender.send(());
|
||||
}
|
||||
PersistenceAction::SaveBlocks((blocks, sender)) => {
|
||||
PersistenceAction::SaveBlocks(blocks, sender) => {
|
||||
let Some(last_block) = blocks.last() else {
|
||||
let _ = sender.send(None);
|
||||
continue
|
||||
@@ -89,13 +89,13 @@ where
|
||||
// we ignore the error because the caller may or may not care about the result
|
||||
let _ = sender.send(Some(last_block_hash));
|
||||
}
|
||||
PersistenceAction::PruneBefore((block_num, sender)) => {
|
||||
PersistenceAction::PruneBefore(block_num, sender) => {
|
||||
let res = self.prune_before(block_num)?;
|
||||
|
||||
// we ignore the error because the caller may or may not care about the result
|
||||
let _ = sender.send(res);
|
||||
}
|
||||
PersistenceAction::WriteTransactions((block, sender)) => {
|
||||
PersistenceAction::WriteTransactions(block, sender) => {
|
||||
unimplemented!()
|
||||
// let (block_num, td) =
|
||||
// self.write_transactions(block).expect("todo: handle errors");
|
||||
@@ -130,24 +130,24 @@ pub enum PersistenceAction {
|
||||
///
|
||||
/// First, header, transaction, and receipt-related data should be written to static files.
|
||||
/// Then the execution history-related data will be written to the database.
|
||||
SaveBlocks((Vec<ExecutedBlock>, oneshot::Sender<Option<B256>>)),
|
||||
SaveBlocks(Vec<ExecutedBlock>, oneshot::Sender<Option<B256>>),
|
||||
|
||||
/// The given block has been added to the canonical chain, its transactions and headers will be
|
||||
/// persisted for durability.
|
||||
///
|
||||
/// This will first append the header and transactions to static files, then update the
|
||||
/// checkpoints for headers and block bodies in the database.
|
||||
WriteTransactions((Arc<SealedBlock>, oneshot::Sender<()>)),
|
||||
WriteTransactions(Arc<SealedBlock>, oneshot::Sender<()>),
|
||||
|
||||
/// Removes block data above the given block number from the database.
|
||||
///
|
||||
/// This will first update checkpoints from the database, then remove actual block data from
|
||||
/// static files.
|
||||
RemoveBlocksAbove((u64, oneshot::Sender<()>)),
|
||||
RemoveBlocksAbove(u64, oneshot::Sender<()>),
|
||||
|
||||
/// Prune associated block data before the given block number, according to already-configured
|
||||
/// prune modes.
|
||||
PruneBefore((u64, oneshot::Sender<PrunerOutput>)),
|
||||
PruneBefore(u64, oneshot::Sender<PrunerOutput>),
|
||||
}
|
||||
|
||||
/// A handle to the persistence service
|
||||
@@ -206,7 +206,7 @@ impl PersistenceHandle {
|
||||
blocks: Vec<ExecutedBlock>,
|
||||
tx: oneshot::Sender<Option<B256>>,
|
||||
) -> Result<(), SendError<PersistenceAction>> {
|
||||
self.send_action(PersistenceAction::SaveBlocks((blocks, tx)))
|
||||
self.send_action(PersistenceAction::SaveBlocks(blocks, tx))
|
||||
}
|
||||
|
||||
/// Tells the persistence service to remove blocks above a certain block number. The removed
|
||||
@@ -218,7 +218,7 @@ impl PersistenceHandle {
|
||||
block_num: u64,
|
||||
tx: oneshot::Sender<()>,
|
||||
) -> Result<(), SendError<PersistenceAction>> {
|
||||
self.send_action(PersistenceAction::RemoveBlocksAbove((block_num, tx)))
|
||||
self.send_action(PersistenceAction::RemoveBlocksAbove(block_num, tx))
|
||||
}
|
||||
|
||||
/// Tells the persistence service to remove block data before the given hash, according to the
|
||||
@@ -230,7 +230,7 @@ impl PersistenceHandle {
|
||||
block_num: u64,
|
||||
tx: oneshot::Sender<PrunerOutput>,
|
||||
) -> Result<(), SendError<PersistenceAction>> {
|
||||
self.send_action(PersistenceAction::PruneBefore((block_num, tx)))
|
||||
self.send_action(PersistenceAction::PruneBefore(block_num, tx))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2187,7 +2187,7 @@ mod tests {
|
||||
|
||||
let received_action =
|
||||
test_harness.action_rx.recv().expect("Failed to receive save blocks action");
|
||||
if let PersistenceAction::SaveBlocks((saved_blocks, _)) = received_action {
|
||||
if let PersistenceAction::SaveBlocks(saved_blocks, _) = received_action {
|
||||
// only blocks.len() - tree_config.persistence_threshold() will be
|
||||
// persisted
|
||||
let expected_persist_len = blocks.len() - tree_config.persistence_threshold() as usize;
|
||||
|
||||
Reference in New Issue
Block a user