Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Remove unused code in state-db (#13103)
Browse files Browse the repository at this point in the history
  • Loading branch information
skunert authored Jan 9, 2023
1 parent 911f65b commit f31588b
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions client/state-db/src/noncanonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
&self,
level_index: usize,
discarded_journals: &mut Vec<Vec<u8>>,
discarded_blocks: &mut Vec<BlockHash>,
hash: &BlockHash,
) {
if let Some(level) = self.levels.get(level_index) {
Expand All @@ -335,13 +334,7 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
.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);
}
});
}
Expand Down Expand Up @@ -393,7 +386,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
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
Expand All @@ -411,12 +403,7 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
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,
Expand All @@ -437,7 +424,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
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);

Expand Down Expand Up @@ -548,9 +534,6 @@ impl<BlockHash: Hash, Key: Hash> NonCanonicalOverlay<BlockHash, Key> {
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,
Expand Down

0 comments on commit f31588b

Please sign in to comment.