hopr_chain_indexer/
config.rs

1/// Configuration for the chain indexer functionality
2#[derive(Debug, Clone, Copy, smart_default::SmartDefault)]
3pub struct IndexerConfig {
4    /// The block at which the indexer should start
5    ///
6    /// It typically makes little sense to start indexing from the beginning
7    /// of the chain; all that is sufficient is to start indexing since the
8    /// relevant smart contracts were introduced into the chain.
9    ///
10    /// This value makes sure that indexing is relevant and as minimal as possible.
11    ///
12    /// Default is `0`.
13    pub start_block_number: u64,
14
15    /// Whether to use fast synchronization during indexing.
16    /// When enabled, it allows for quicker indexing of existing logs during node startup.
17    ///
18    /// Default is `true`.
19    #[default(true)]
20    pub fast_sync: bool,
21}
22
23impl IndexerConfig {
24    /// Creates a new indexer configuration.
25    ///
26    /// # Arguments
27    ///
28    /// * `start_block_number` - The block number from which to start indexing
29    /// * `fast_sync` - Whether to enable fast synchronization during startup
30    ///
31    /// # Returns
32    ///
33    /// A new instance of `IndexerConfig`
34    pub fn new(start_block_number: u64, fast_sync: bool) -> Self {
35        Self {
36            start_block_number,
37            fast_sync,
38        }
39    }
40}