massa_models/
active_block.rs

1use crate::{
2    address::Address,
3    block_id::BlockId,
4    prehash::{PreHashMap, PreHashSet},
5    slot::Slot,
6};
7
8use serde::{Deserialize, Serialize};
9
10/// Block that was checked as valid, with some useful pre-computed data
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct ActiveBlock {
13    /// The creator's address
14    pub creator_address: Address,
15    /// The id of the block
16    pub block_id: BlockId,
17    /// one (block id, period) per thread ( if not genesis )
18    pub parents: Vec<(BlockId, u64)>,
19    /// one `HashMap<Block id, period>` per thread (blocks that need to be kept)
20    /// Children reference that block as a parent
21    pub children: Vec<PreHashMap<BlockId, u64>>,
22    /// Blocks id that have this block as an ancestor
23    pub descendants: PreHashSet<BlockId>,
24    /// for example has its fitness reached the given threshold
25    pub is_final: bool,
26    /// Slot of the block.
27    pub slot: Slot,
28    /// Fitness
29    pub fitness: u64,
30    /// Same-thread parent creator
31    pub same_thread_parent_creator: Option<Address>,
32}