avalanche_consensus/
context.rs1use avalanche_types::ids::{node::Id as NodeId, Id};
3
4pub struct Context {
7 network_id: u32,
8
9 subnet_id: Id,
10 chain_id: Id,
11 node_id: NodeId,
12}
13
14impl Default for Context {
15 fn default() -> Self {
16 Self::new()
17 }
18}
19
20impl Context {
21 pub fn new() -> Self {
22 Self {
23 network_id: 1,
24 subnet_id: Id::empty(),
25 chain_id: Id::empty(),
26 node_id: NodeId::empty(),
27 }
28 }
29
30 pub fn network_id(&self) -> u32 {
31 self.network_id
32 }
33
34 pub fn subnet_id(&self) -> Id {
35 self.subnet_id
36 }
37
38 pub fn chain_id(&self) -> Id {
39 self.chain_id
40 }
41
42 pub fn node_id(&self) -> NodeId {
43 self.node_id
44 }
45}