openmina_core/block/
applied_block.rs

1use std::{ops::Deref, sync::Arc};
2
3use super::ArcBlockWithHash;
4use mina_p2p_messages::v2;
5use serde::{Deserialize, Serialize};
6
7#[derive(Serialize, Deserialize, Debug, Clone)]
8pub struct AppliedBlock {
9    pub block: ArcBlockWithHash,
10    pub just_emitted_a_proof: bool,
11}
12
13impl std::cmp::PartialEq for AppliedBlock {
14    fn eq(&self, other: &Self) -> bool {
15        self.block == other.block
16    }
17}
18
19impl Deref for AppliedBlock {
20    type Target = ArcBlockWithHash;
21
22    fn deref(&self) -> &Self::Target {
23        &self.block
24    }
25}
26
27impl AppliedBlock {
28    pub fn block_with_hash(&self) -> &ArcBlockWithHash {
29        &self.block
30    }
31
32    pub fn block(&self) -> &Arc<v2::MinaBlockBlockStableV2> {
33        &self.block_with_hash().block
34    }
35}