dusk_node/mempool/
conf.rs1use std::fmt::Formatter;
8use std::time::Duration;
9
10use serde::{Deserialize, Serialize};
11
12pub const DEFAULT_EXPIRY_TIME: Duration = Duration::from_secs(3 * 60 * 60 * 24); pub const DEFAULT_IDLE_INTERVAL: Duration = Duration::from_secs(60 * 60); pub const DEFAULT_DOWNLOAD_REDUNDANCY: usize = 5;
16
17#[derive(Serialize, Deserialize, Copy, Clone)]
18pub struct Params {
19 pub max_queue_size: usize,
21
22 pub max_mempool_txn_count: usize,
24
25 #[serde(with = "humantime_serde")]
27 pub idle_interval: Option<Duration>,
28
29 #[serde(with = "humantime_serde")]
31 pub mempool_expiry: Option<Duration>,
32
33 pub mempool_download_redundancy: Option<usize>,
35}
36
37impl Default for Params {
38 fn default() -> Self {
39 Self {
40 max_queue_size: 1000,
41 max_mempool_txn_count: 10_000,
42 idle_interval: Some(DEFAULT_IDLE_INTERVAL),
43 mempool_expiry: Some(DEFAULT_EXPIRY_TIME),
44 mempool_download_redundancy: Some(DEFAULT_DOWNLOAD_REDUNDANCY),
45 }
46 }
47}
48
49impl std::fmt::Display for Params {
50 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
51 write!(
52 f,
53 "max_queue_size: {}, max_mempool_txn_count: {},
54 idle_interval: {:?}, mempool_expiry: {:?}, mempool_download_redundancy: {:?}",
55 self.max_queue_size,
56 self.max_mempool_txn_count,
57 self.idle_interval,
58 self.mempool_expiry,
59 self.mempool_download_redundancy
60 )
61 }
62}