Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: add Config::seed constructor
Fintan Halpenny committed 2 years ago
commit f7b53139f48cbee3a0799b82043b1aec675fbb58
parent b6d8bc94897cd547bf564f574349d22659ad28f6
1 file changed +26 -0
modified radicle/src/node/config.rs
@@ -227,6 +227,32 @@ impl Config {
        }
    }

+
    /// Configuration for a test seed node.
+
    ///
+
    /// It sets the `RateLimit::capacity` to `usize::MAX` ensuring
+
    /// that there are no rate limits for test nodes, since they all
+
    /// operate on the same IP address. This prevents any announcement
+
    /// messages from being dropped.
+
    pub fn seed(alias: Alias) -> Self {
+
        Self {
+
            network: Network::Test,
+
            limits: Limits {
+
                rate: RateLimits {
+
                    inbound: RateLimit {
+
                        fill_rate: 1.0,
+
                        capacity: usize::MAX,
+
                    },
+
                    outbound: RateLimit {
+
                        fill_rate: 1.0,
+
                        capacity: usize::MAX,
+
                    },
+
                },
+
                ..Limits::default()
+
            },
+
            ..Self::new(alias)
+
        }
+
    }
+

    pub fn new(alias: Alias) -> Self {
        Self {
            alias,