pub fn execute(&mut self, at_depth: u64) {
        let mut prune_candidates = vec![];

        while let Some(candidate) = self.state_root_prune_queue.pop() {
            if candidate.0 <= at_depth {
                prune_candidates.push(candidate);
            } else {
                self.state_root_prune_queue.push(candidate);
                break;
            }
        }

        let mut total_pruned_entries: usize = 0;
        for candidate in prune_candidates {
            match MerkleRadixTree::prune(&self.state_database, &hex::encode(&candidate.1)) {
                Ok(removed_keys) => {
                    total_pruned_entries += removed_keys.len();

                    // the state root was not pruned (it is likely the root of a
                    // fork), so push it back into the queue.
                    if removed_keys.is_empty() {
                        self.state_root_prune_queue.push(candidate);
                    } else {
                        counter!("state.StatePruneManager.state_roots_pruned", 1);
                    }
                }
                Err(err) => {
                    error!(
                        "Unable to prune state root {}: {:?}",
                        hex::encode(&candidate.1),
                        err
                    );
                    self.state_root_prune_queue.push(candidate);
                }
            }
        }

        if total_pruned_entries > 0 {
            info!(
                "Pruned {} keys from the Global state Database",
                total_pruned_entries
            );
        }
    }
/// Executes prune on any state root hash at or below the given depth.
Executes prune on any state root hash at or below the given depth.
Executes prune on any state root hash at or below the given depth .
pub fn execute(&mut self, at_depth: u64) {
        let mut prune_candidates = vec![];
        while let Some(candidate) = self.state_root_prune_queue.pop() {
            if candidate.0 <= at_depth {
                prune_candidates.push(candidate);
            } else {
                self.state_root_prune_queue.push(candidate);
                break;
            }
        }
        let mut total_pruned_entries: usize = 0;
        for candidate in prune_candidates {
            match MerkleRadixTree::prune(&self.state_database, &hex::encode(&candidate.1)) {
                Ok(removed_keys) => {
                    total_pruned_entries += removed_keys.len();
                    // the state root was not pruned (it is likely the root of a
                    // fork), so push it back into the queue.
                    if removed_keys.is_empty() {
                        self.state_root_prune_queue.push(candidate);
                    } else {
                        counter!("state.StatePruneManager.state_roots_pruned", 1);
                    }
                }
                Err(err) => {
                    error!(
                        "Unable to prune state root {}: {:?}",
                        hex::encode(&candidate.1),
                        err
                    );
                    self.state_root_prune_queue.push(candidate);
                }
            }
        }
        if total_pruned_entries > 0 {
            info!(
                "Pruned {} keys from the Global state Database",
                total_pruned_entries
            );
        }
    }
pub fn execute ( & mut self , at_depth : u64 ) { let mut prune_candidates = vec ! [ ] ; while let Some ( candidate ) = self . state_root_prune_queue . pop ( ) { if candidate . 0 <= at_depth { prune_candidates . push ( candidate ) ; } else { self . state_root_prune_queue . push ( candidate ) ; break ; } } let mut total_pruned_entries : usize = 0 ; for candidate in prune_candidates { match MerkleRadixTree :: prune ( & self . state_database , & hex :: encode ( & candidate . 1 ) ) { Ok ( removed_keys ) => { total_pruned_entries += removed_keys . len ( ) ; // the state root was not pruned (it is likely the root of a // fork), so push it back into the queue. if removed_keys . is_empty ( ) { self . state_root_prune_queue . push ( candidate ) ; } else { counter ! ( " " 1 ) ; } } Err ( err ) => { error ! ( " " hex encode ( candidate 1 ) err ) ; self . state_root_prune_queue . push ( candidate ) ; } } } if total_pruned_entries > 0 { info ! ( " " total_pruned_entries ) ; } }
Executes prune on any state root hash at or below the given depth.
Executes prune on any state root hash at or below the given depth .
&mut self
at_depth
u64
&mut self
at_depth
u64