Skip to content

Commit

Permalink
Rewrite stable thing (paritytech#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
boundless-forest authored May 9, 2022
1 parent 9f62ebb commit 4238c5c
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions client/rpc/src/eth/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,24 +404,7 @@ where
*notification.header.number(),
);

// BTreeMap::retain is unstable :c.
// 1. We collect all keys to remove.
// 2. We remove them.
let remove_list: Vec<_> = filter_pool
.iter()
.filter_map(|(&k, v)| {
let lifespan_limit = v.at_block + retain_threshold;
if lifespan_limit <= imported_number {
Some(k)
} else {
None
}
})
.collect();

for key in remove_list {
filter_pool.remove(&key);
}
filter_pool.retain(|_, v| v.at_block + retain_threshold > imported_number);
}
}
}
Expand Down

0 comments on commit 4238c5c

Please sign in to comment.