From 2dca3e07fae11460151efda09d767cb417a2716c Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 6 Aug 2024 00:43:52 +0200 Subject: [PATCH] chore: rm redundant ( (#10112) --- crates/engine/tree/src/persistence.rs | 22 +++++++++++----------- crates/engine/tree/src/tree/mod.rs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/engine/tree/src/persistence.rs b/crates/engine/tree/src/persistence.rs index bfb04bce06f59..ca4d815230414 100644 --- a/crates/engine/tree/src/persistence.rs +++ b/crates/engine/tree/src/persistence.rs @@ -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, oneshot::Sender>)), + SaveBlocks(Vec, oneshot::Sender>), /// 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, oneshot::Sender<()>)), + WriteTransactions(Arc, 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)), + PruneBefore(u64, oneshot::Sender), } /// A handle to the persistence service @@ -206,7 +206,7 @@ impl PersistenceHandle { blocks: Vec, tx: oneshot::Sender>, ) -> Result<(), SendError> { - 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> { - 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, ) -> Result<(), SendError> { - self.send_action(PersistenceAction::PruneBefore((block_num, tx))) + self.send_action(PersistenceAction::PruneBefore(block_num, tx)) } } diff --git a/crates/engine/tree/src/tree/mod.rs b/crates/engine/tree/src/tree/mod.rs index 0f71d9dd371bc..8d0f111381189 100644 --- a/crates/engine/tree/src/tree/mod.rs +++ b/crates/engine/tree/src/tree/mod.rs @@ -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;