/// Recomputes the list of pending batches
///
/// Args:
///   committed (List<Batches>): Batches committed in the current chain
///   since the root of the fork switching from.
///   uncommitted (List<Batches): Batches that were committed in the old
///   fork since the common root.
Recomputes the list of pending batches
Args:
committed (List): Batches committed in the current chain
since the root of the fork switching from.
uncommitted (List<Batches): Batches that were committed in the old
fork since the common root.
Recomputes the list of pending batches Args : committed ( List ) : Batches committed in the current chain since the root of the fork switching from . uncommitted ( List<Batches ) : Batches that were committed in the old fork since the common root .
pub fn rebuild(&mut self, committed: Option<Vec<Batch>>, uncommitted: Option<Vec<Batch>>) {
        let committed_set = if let Some(committed) = committed {
            committed
                .iter()
                .map(|i| i.get_header_signature().into())
                .collect::<HashSet<String>>()
        } else {
            HashSet::new()
        };
        let previous_batches = self.batches.clone();
        self.reset();
        // Uncommitted and pending are disjoint sets since batches can only be
        // committed to a chain once.
        if let Some(batch_list) = uncommitted {
            for batch in batch_list {
                if !committed_set.contains(batch.get_header_signature()) {
                    self.append(batch);
                }
            }
        }
        for batch in previous_batches {
            if !committed_set.contains(batch.get_header_signature()) {
                self.append(batch);
            }
        }
    }
pub fn rebuild ( & mut self , committed : Option < Vec < Batch > > , uncommitted : Option < Vec < Batch > > ) { let committed_set = if let Some ( committed ) = committed { committed . iter ( ) . map ( | i | i . get_header_signature ( ) . into ( ) ) . collect :: < HashSet < String > > ( ) } else { HashSet :: new ( ) } ; let previous_batches = self . batches . clone ( ) ; self . reset ( ) ; // Uncommitted and pending are disjoint sets since batches can only be // committed to a chain once. if let Some ( batch_list ) = uncommitted { for batch in batch_list { if ! committed_set . contains ( batch . get_header_signature ( ) ) { self . append ( batch ) ; } } } for batch in previous_batches { if ! committed_set . contains ( batch . get_header_signature ( ) ) { self . append ( batch ) ; } } }
Recomputes the list of pending batches
Args:
committed (List<Batches>): Batches committed in the current chain
since the root of the fork switching from.
Recomputes the list of pending batches Args : committed ( List<Batches > ) : Batches committed in the current chain since the root of the fork switching from .
&mut self
committed
Option<Vec<Batch>>
uncommitted
Option<Vec<Batch>>