@@ -84,7 +84,7 @@ impl Journal {
|
||||
pub fn apply(self, db: &mut HashDB) -> Score {
|
||||
trace!("applying {:?} changes", self.0.len());
|
||||
let mut ret = Score{inserts: 0, removes: 0};
|
||||
for d in self.0.into_iter() {
|
||||
for d in self.0 {
|
||||
match d {
|
||||
Operation::Delete(h) => {
|
||||
trace!("TrieDBMut::apply --- {:?}", &h);
|
||||
|
||||
@@ -87,7 +87,7 @@ impl<'db> TrieDB<'db> {
|
||||
/// Convert a vector of hashes to a hashmap of hash to occurrences.
|
||||
pub fn to_map(hashes: Vec<H256>) -> HashMap<H256, u32> {
|
||||
let mut r: HashMap<H256, u32> = HashMap::new();
|
||||
for h in hashes.into_iter() {
|
||||
for h in hashes {
|
||||
*r.entry(h).or_insert(0) += 1;
|
||||
}
|
||||
r
|
||||
@@ -97,7 +97,7 @@ impl<'db> TrieDB<'db> {
|
||||
/// trie.
|
||||
pub fn db_items_remaining(&self) -> super::Result<HashMap<H256, i32>> {
|
||||
let mut ret = self.db.keys();
|
||||
for (k, v) in Self::to_map(try!(self.keys())).into_iter() {
|
||||
for (k, v) in Self::to_map(try!(self.keys())) {
|
||||
let keycount = *ret.get(&k).unwrap_or(&0);
|
||||
match keycount <= v as i32 {
|
||||
true => ret.remove(&k),
|
||||
|
||||
Reference in New Issue
Block a user