diff --git a/client/state-db/src/noncanonical.rs b/client/state-db/src/noncanonical.rs index b7eec8ab60ee0..e950d245dcec9 100644 --- a/client/state-db/src/noncanonical.rs +++ b/client/state-db/src/noncanonical.rs @@ -323,7 +323,6 @@ impl NonCanonicalOverlay { &self, level_index: usize, discarded_journals: &mut Vec>, - discarded_blocks: &mut Vec, hash: &BlockHash, ) { if let Some(level) = self.levels.get(level_index) { @@ -335,13 +334,7 @@ impl NonCanonicalOverlay { .clone(); if parent == *hash { discarded_journals.push(overlay.journal_key.clone()); - discarded_blocks.push(overlay.hash.clone()); - self.discard_journals( - level_index + 1, - discarded_journals, - discarded_blocks, - &overlay.hash, - ); + self.discard_journals(level_index + 1, discarded_journals, &overlay.hash); } }); } @@ -393,7 +386,6 @@ impl NonCanonicalOverlay { self.pinned_canonincalized.push(hash.clone()); let mut discarded_journals = Vec::new(); - let mut discarded_blocks = Vec::new(); for (i, overlay) in level.blocks.into_iter().enumerate() { let mut pinned_children = 0; // That's the one we need to canonicalize @@ -411,12 +403,7 @@ impl NonCanonicalOverlay { commit.data.deleted.extend(overlay.deleted.clone()); } else { // Discard this overlay - self.discard_journals( - 0, - &mut discarded_journals, - &mut discarded_blocks, - &overlay.hash, - ); + self.discard_journals(0, &mut discarded_journals, &overlay.hash); pinned_children = discard_descendants( &mut self.levels.as_mut_slices(), &mut self.values, @@ -437,7 +424,6 @@ impl NonCanonicalOverlay { discard_values(&mut self.values, overlay.inserted); } discarded_journals.push(overlay.journal_key.clone()); - discarded_blocks.push(overlay.hash.clone()); } commit.meta.deleted.append(&mut discarded_journals); @@ -548,9 +534,6 @@ impl NonCanonicalOverlay { trace!(target: "state-db-pin", "Discarding unpinned non-canon block: {:?}", hash); discard_values(&mut self.values, inserted); self.parents.remove(&hash); - true - } else { - false } }, Entry::Vacant(_) => break,