fuel_core_poa/
config.rs

1use fuel_core_types::{
2    fuel_types::ChainId,
3    signer::SignMode,
4};
5use tokio::time::Duration;
6
7#[derive(Debug, Clone)]
8pub struct Config {
9    pub trigger: Trigger,
10    pub signer: SignMode,
11    pub metrics: bool,
12    pub min_connected_reserved_peers: usize,
13    pub time_until_synced: Duration,
14    pub production_timeout: Duration,
15    pub chain_id: ChainId,
16}
17
18#[cfg(feature = "test-helpers")]
19impl Default for Config {
20    fn default() -> Self {
21        Config {
22            trigger: Trigger::default(),
23            signer: SignMode::Unavailable,
24            metrics: false,
25            min_connected_reserved_peers: 0,
26            time_until_synced: Duration::ZERO,
27            production_timeout: Duration::from_secs(20),
28            chain_id: ChainId::default(),
29        }
30    }
31}
32
33/// Block production trigger for PoA operation
34#[derive(Default, Clone, Copy, Debug, PartialEq, Eq)]
35pub enum Trigger {
36    /// A new block is produced instantly when transactions are available.
37    /// This is useful for some test cases.
38    #[default]
39    Instant,
40    /// This node doesn't produce new blocks. Used for passive listener nodes.
41    Never,
42    /// A new block is produced periodically. Used to simulate consensus block delay.
43    Interval { block_time: Duration },
44    /// Opens the block production immediately and keeps it open for the specified period.
45    /// After period is over, the block is produced.
46    Open { period: Duration },
47}