fn compute()

in bft-lib/src/simulated_context.rs [128:157]


    fn compute(
        &mut self,
        base_state: &State,
        command: Command,
        time: NodeTime,
        _previous_author: Option<Author>,
        _previous_voters: Vec<Author>,
    ) -> Option<State> {
        match self.get_ledger_state(base_state) {
            Some(ledger_state) => {
                let mut new_ledger_state = ledger_state.clone();
                new_ledger_state.execute(command.clone(), time);
                let new_state = new_ledger_state.key();
                self.pending_ledger_states
                    .insert(new_state.clone(), new_ledger_state);
                info!(
                    "{:?}{:?} Executing {:?} after {:?} gave {:?}",
                    self.author, time, command, base_state, new_state
                );
                Some(new_state)
            }
            None => {
                error!(
                    "{:?}{:?} Trying to executing {:?} after {:?} but the base state is not available",
                    self.author, time, command, base_state
                );
                None
            }
        }
    }