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

Commit

Permalink
Revert questionable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork committed May 24, 2022
1 parent 064de3d commit 4f456f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
5 changes: 2 additions & 3 deletions primitives/state-machine/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,8 @@ where
}

self.mark_dirty();
let overlay_count = self.overlay.clear_prefix(prefix);
let (all, count) = self.limit_remove_from_backend(None, Some(prefix), limit);
(all, count + overlay_count)
self.overlay.clear_prefix(prefix);
self.limit_remove_from_backend(None, Some(prefix), limit)
}

fn clear_child_prefix(
Expand Down
7 changes: 1 addition & 6 deletions primitives/state-machine/src/overlayed_changes/changeset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,15 +410,10 @@ impl OverlayedChangeSet {
&mut self,
predicate: impl Fn(&[u8], &OverlayedValue) -> bool,
at_extrinsic: Option<u32>,
) -> u32 {
let mut count = 0;
) {
for (key, val) in self.changes.iter_mut().filter(|(k, v)| predicate(k, v)) {
if val.value_ref().is_some() {
count += 1;
}
val.set(None, insert_dirty(&mut self.dirty_keys, key.clone()), at_extrinsic);
}
count
}

/// Get the iterator over all changes that follow the supplied `key`.
Expand Down
4 changes: 2 additions & 2 deletions primitives/state-machine/src/overlayed_changes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ impl OverlayedChanges {
/// Removes all key-value pairs which keys share the given prefix.
///
/// Can be rolled back or committed when called inside a transaction.
pub(crate) fn clear_prefix(&mut self, prefix: &[u8]) -> u32 {
self.top.clear_where(|key, _| key.starts_with(prefix), self.extrinsic_index())
pub(crate) fn clear_prefix(&mut self, prefix: &[u8]) {
self.top.clear_where(|key, _| key.starts_with(prefix), self.extrinsic_index());
}

/// Removes all key-value pairs which keys share the given prefix.
Expand Down

0 comments on commit 4f456f8

Please sign in to comment.