kaspa_consensus_core/
trusted.rs1use crate::{block::Block, header::Header, BlockHashMap, BlueWorkType, KType};
2use kaspa_hashes::Hash;
3use serde::{Deserialize, Serialize};
4use std::sync::Arc;
5
6#[derive(Clone, Serialize, Deserialize)]
8pub struct ExternalGhostdagData {
9 pub blue_score: u64,
10 pub blue_work: BlueWorkType,
11 pub selected_parent: Hash,
12 pub mergeset_blues: Vec<Hash>,
13 pub mergeset_reds: Vec<Hash>,
14 pub blues_anticone_sizes: BlockHashMap<KType>,
15}
16
17pub struct TrustedBlock {
21 pub block: Block,
22 pub ghostdag: ExternalGhostdagData,
23}
24
25impl TrustedBlock {
26 pub fn new(block: Block, ghostdag: ExternalGhostdagData) -> Self {
27 Self { block, ghostdag }
28 }
29}
30
31pub struct TrustedHeader {
35 pub header: Arc<Header>,
36 pub ghostdag: ExternalGhostdagData,
37}
38
39impl TrustedHeader {
40 pub fn new(header: Arc<Header>, ghostdag: ExternalGhostdagData) -> Self {
41 Self { header, ghostdag }
42 }
43}
44
45pub struct TrustedGhostdagData {
47 pub hash: Hash,
48 pub ghostdag: ExternalGhostdagData,
49}
50
51impl TrustedGhostdagData {
52 pub fn new(hash: Hash, ghostdag: ExternalGhostdagData) -> Self {
53 Self { hash, ghostdag }
54 }
55}