Skip to content

Commit

Permalink
node: Request full mempool data from N alive peers
Browse files Browse the repository at this point in the history
  • Loading branch information
Goshawk committed Aug 15, 2024
1 parent 8395a1f commit f2e6a17
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions node/src/mempool/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::{fmt::Formatter, time::Duration};
/// Mempool configuration parameters
pub const DEFAULT_EXPIRY_TIME: Duration = Duration::from_secs(3 * 60 * 60 * 24); /* 3 days */
pub const DEFAULT_IDLE_INTERVAL: Duration = Duration::from_secs(60 * 60); /* 1 hour */
pub const DEFAULT_DOWNLOAD_REDUNDANCY: usize = 5;

#[derive(Serialize, Deserialize, Copy, Clone)]
pub struct Params {
Expand All @@ -26,6 +27,9 @@ pub struct Params {
/// Duration after which a transaction is removed from the mempool
#[serde(with = "humantime_serde")]
pub mempool_expiry: Option<Duration>,

/// max number of peers to request mempool from
pub mempool_download_redundancy: Option<usize>,
}

impl Default for Params {
Expand All @@ -35,6 +39,7 @@ impl Default for Params {
max_mempool_txn_count: 10_000,
idle_interval: Some(DEFAULT_IDLE_INTERVAL),
mempool_expiry: Some(DEFAULT_EXPIRY_TIME),
mempool_download_redundancy: Some(DEFAULT_DOWNLOAD_REDUNDANCY),
}
}
}
Expand All @@ -44,11 +49,12 @@ impl std::fmt::Display for Params {
write!(
f,
"max_queue_size: {}, max_mempool_txn_count: {},
idle_interval: {:?}, mempool_expiry: {:?}",
idle_interval: {:?}, mempool_expiry: {:?}, mempool_download_redundancy: {:?}",
self.max_queue_size,
self.max_mempool_txn_count,
self.idle_interval,
self.mempool_expiry
self.mempool_expiry,
self.mempool_download_redundancy
)
}
}

0 comments on commit f2e6a17

Please sign in to comment.