node/block_producer/
block_producer_event.rs1use std::sync::Arc;
2
3use mina_p2p_messages::v2::{MinaBaseProofStableV2, StateHash};
4use serde::{Deserialize, Serialize};
5
6pub use super::vrf_evaluator::BlockProducerVrfEvaluatorEvent;
7
8#[derive(derive_more::From, Serialize, Deserialize, Debug, Clone)]
9pub enum BlockProducerEvent {
10 VrfEvaluator(BlockProducerVrfEvaluatorEvent),
11 BlockProve(StateHash, Result<Arc<MinaBaseProofStableV2>, String>),
12}
13
14impl std::fmt::Display for BlockProducerEvent {
15 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16 write!(f, "BlockProducer, ")?;
17 match self {
18 Self::VrfEvaluator(e) => e.fmt(f),
19 Self::BlockProve(block_hash, res) => {
20 let res = res.as_ref().map_or("Err", |_| "Ok");
21 write!(f, "BlockProveSuccess, {block_hash}, {res}")
22 }
23 }
24 }
25}