pub(crate) fn propose(
        &mut self,
        value: C::ConsensusValue,
        block_context: BlockContext<C>,
        state: &State<C>,
        instance_id: C::InstanceId,
    ) -> Vec<Effect<C>> {
        let timestamp = block_context.timestamp();
        let panorama = if let Some((expected_context, panorama)) = self.next_proposal.take() {
            if expected_context != block_context {
                warn!(?expected_context, ?block_context, "unexpected proposal");
                return vec![];
            }
            panorama
        } else {
            warn!("unexpected proposal value");
            return vec![];
        };
        if self.earliest_unit_time(state) > timestamp {
            warn!(?block_context, "skipping outdated proposal");
            return vec![];
        }
        if self.is_faulty(state) {
            warn!("Creator knows it's faulty. Won't create a message.");
            return vec![];
        }
        self.new_unit(panorama, timestamp, Some(value), state, instance_id)
            .map(|proposal_unit| Effect::NewVertex(ValidVertex(Vertex::Unit(proposal_unit))))
            .into_iter()
            .collect()
    }
/// Proposes a new block with the given consensus value.
Proposes a new block with the given consensus value.
Proposes a new block with the given consensus value .
pub(crate) fn propose(
        &mut self,
        value: C::ConsensusValue,
        block_context: BlockContext<C>,
        state: &State<C>,
        instance_id: C::InstanceId,
    ) -> Vec<Effect<C>> {
        let timestamp = block_context.timestamp();
        let panorama = if let Some((expected_context, panorama)) = self.next_proposal.take() {
            if expected_context != block_context {
                warn!(?expected_context, ?block_context, "unexpected proposal");
                return vec![];
            }
            panorama
        } else {
            warn!("unexpected proposal value");
            return vec![];
        };
        if self.earliest_unit_time(state) > timestamp {
            warn!(?block_context, "skipping outdated proposal");
            return vec![];
        }
        if self.is_faulty(state) {
            warn!("Creator knows it's faulty. Won't create a message.");
            return vec![];
        }
        self.new_unit(panorama, timestamp, Some(value), state, instance_id)
            .map(|proposal_unit| Effect::NewVertex(ValidVertex(Vertex::Unit(proposal_unit))))
            .into_iter()
            .collect()
    }
pub ( crate ) fn propose ( & mut self , value : C :: ConsensusValue , block_context : BlockContext < C > , state : & State < C > , instance_id : C :: InstanceId , ) -> Vec < Effect < C > > { let timestamp = block_context . timestamp ( ) ; let panorama = if let Some ( ( expected_context , panorama ) ) = self . next_proposal . take ( ) { if expected_context != block_context { warn ! ( expected_context block_context " " ) ; return vec ! [ ] ; } panorama } else { warn ! ( " " ) ; return vec ! [ ] ; } ; if self . earliest_unit_time ( state ) > timestamp { warn ! ( block_context " " ) ; return vec ! [ ] ; } if self . is_faulty ( state ) { warn ! ( " " ) ; return vec ! [ ] ; } self . new_unit ( panorama , timestamp , Some ( value ) , state , instance_id ) . map ( | proposal_unit | Effect :: NewVertex ( ValidVertex ( Vertex :: Unit ( proposal_unit ) ) ) ) . into_iter ( ) . collect ( ) }
Proposes a new block with the given consensus value.
Proposes a new block with the given consensus value .
&mut self
value
C::ConsensusValue
block_context
BlockContext<C>
state
&State<C>
instance_id
C::InstanceId
&mut self
value
C::ConsensusValue
block_context
BlockContext<C>
state
&State<C>
instance_id
C::InstanceId