pub fn initialize_block(&self, previous_block: BlockPair) -> Result<(), BlockPublisherError> {
        let mut candidate_block = self
            .candidate_block
            .lock()
            .map_err(|_| BlockPublisherError::Internal("Candidate block lock poisoned".into()))?;

        if candidate_block.is_some() {
            Err(BlockInitializationError::BlockInProgress.into())
        } else {
            *candidate_block = Some(self.new_candidate_block(previous_block)?);
            Ok(())
        }
    }
/// Starts a new block on top of an existing block and schedules as many transactions as the
/// block and pending batches pool allow
///
/// # Arguments
///
/// * `previous_block` - The block that the new one will be built on top of
///
/// # Errors
///
/// * Returns a `BlockInProgress` error if there is already an in-progress block
/// * Returns a `MissingPredecessor` error if the previous block is not known to the
///   [`BlockManager`](../block_manager/struct.BlockManager.html)
Starts a new block on top of an existing block and schedules as many transactions as the
block and pending batches pool allow
Starts a new block on top of an existing block and schedules as many transactions as the block and pending batches pool allow
pub fn initialize_block(&self, previous_block: BlockPair) -> Result<(), BlockPublisherError> {
        let mut candidate_block = self
            .candidate_block
            .lock()
            .map_err(|_| BlockPublisherError::Internal("Candidate block lock poisoned".into()))?;
        if candidate_block.is_some() {
            Err(BlockInitializationError::BlockInProgress.into())
        } else {
            *candidate_block = Some(self.new_candidate_block(previous_block)?);
            Ok(())
        }
    }
pub fn initialize_block ( & self , previous_block : BlockPair ) -> Result < ( ) , BlockPublisherError > { let mut candidate_block = self . candidate_block . lock ( ) . map_err ( | _ | BlockPublisherError :: Internal ( " " . into ( ) ) ) ? ; if candidate_block . is_some ( ) { Err ( BlockInitializationError :: BlockInProgress . into ( ) ) } else { * candidate_block = Some ( self . new_candidate_block ( previous_block ) ? ) ; Ok ( ( ) ) } }
Starts a new block on top of an existing block and schedules as many transactions as the
block and pending batches pool allow
Starts a new block on top of an existing block and schedules as many transactions as the block and pending batches pool allow
&self
previous_block
BlockPair
&self
previous_block
BlockPair
errors
Returns a `BlockInProgress` error if there is already an in-progress block
Returns a `MissingPredecessor` error if the previous block is not known to the
[`BlockManager`](../block_manager/struct.BlockManager.html)
Returns a ` BlockInProgress ` error if there is already an in - progress block Returns a ` MissingPredecessor ` error if the previous block is not known to the [ ` BlockManager ` ] ( .. / block_manager / struct . BlockManager . html )