p2panda_net/discovery/config.rs
1// SPDX-License-Identifier: MIT OR Apache-2.0
2
3#[derive(Clone, Debug)]
4pub struct DiscoveryConfig {
5 /// Number of random walkers which "explore" the network at the same time.
6 pub random_walkers_count: usize,
7
8 /// Probability of resetting the random walk and starting from scratch, determined on every
9 /// walking step.
10 ///
11 /// ```text
12 /// 0.0 = Never reset
13 /// 1.0 = Always reset
14 /// ```
15 ///
16 /// Defaults to 0.02 (2%) probability.
17 pub reset_walk_probability: f64,
18}
19
20impl Default for DiscoveryConfig {
21 fn default() -> Self {
22 Self {
23 random_walkers_count: 2,
24 reset_walk_probability: 0.02, // 2% chance
25 }
26 }
27}