radicle: add Config::seed constructor
Add a `Config` constructor for testing seed nodes that uses `usize::MAX` for capacity. This allows test scenarios to not drop messages due to rate limiting -- all nodes are on the same IP address and rate limiting is performed per IP address. Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
parent
b6d8bc9489
commit
f7b53139f4
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue