diff --git a/zebrad/src/components/mempool.rs b/zebrad/src/components/mempool.rs index d6c52b49f..efdeee756 100644 --- a/zebrad/src/components/mempool.rs +++ b/zebrad/src/components/mempool.rs @@ -1,4 +1,22 @@ //! Zebra mempool. +//! +//! A zebrad application component that manages the active collection, reception, +//! gossip, verification, in-memory storage, eviction, and rejection of unmined Zcash +//! transactions (those that have not been confirmed in a mined block on the +//! blockchain). +//! +//! Major parts of the mempool include: +//! * [Mempool Service][`Mempool`] +//! * activates when the syncer is near the chain tip +//! * spawns [download and verify tasks][`downloads::Downloads`] for each crawled or gossiped transaction +//! * handles in-memory [storage][`storage::Storage`] of unmined transactions +//! * [Crawler][`crawler::Crawler`] +//! * runs in the background to periodically poll peers for fresh unmined transactions +//! * [Queue Checker][`queue_checker::QueueChecker`] +//! * runs in the background, polling the mempool to store newly verified transactions +//! * [Transaction Gossip Task][`gossip::gossip_mempool_transaction_id`] +//! * runs in the background and gossips newly added mempool transactions +//! to peers use std::{ collections::HashSet, @@ -107,7 +125,7 @@ pub enum Request { /// because the mempool service is wrapped in a `Buffer`. /// Calling [`Buffer::poll_ready`] reserves a buffer slot, which can cause hangs when /// too many slots are reserved but unused: - /// https://docs.rs/tower/0.4.10/tower/buffer/struct.Buffer.html#a-note-on-choosing-a-bound + /// CheckForVerifiedTransactions, } diff --git a/zebrad/src/components/mempool/config.rs b/zebrad/src/components/mempool/config.rs index fbb7f9375..c1afa2805 100644 --- a/zebrad/src/components/mempool/config.rs +++ b/zebrad/src/components/mempool/config.rs @@ -39,7 +39,7 @@ pub struct Config { /// /// This corresponds to `mempoolevictionmemoryminutes` from /// [ZIP-401](https://zips.z.cash/zip-0401#specification). - // + /// // Note: Durations become a TOML table, so they must be the final item in the config // We'll replace them with a more user-friendly format in #2847 pub eviction_memory_time: Duration, @@ -48,15 +48,15 @@ pub struct Config { impl Default for Config { fn default() -> Self { Self { - /// Consensus rules: - /// - /// > There MUST be a configuration option mempooltxcostlimit, - /// > which SHOULD default to 80000000. - /// > - /// > There MUST be a configuration option mempoolevictionmemoryminutes, - /// > which SHOULD default to 60 [minutes]. - /// - /// https://zips.z.cash/zip-0401#specification + // [ZIP-401] Consensus rules: + // + // > There MUST be a configuration option mempooltxcostlimit, + // > which SHOULD default to 80000000. + // > + // > There MUST be a configuration option mempoolevictionmemoryminutes, + // > which SHOULD default to 60 [minutes]. + // + // [ZIP-401]: https://zips.z.cash/zip-0401#specification tx_cost_limit: 80_000_000, eviction_memory_time: Duration::from_secs(60 * 60), diff --git a/zebrad/src/components/mempool/downloads.rs b/zebrad/src/components/mempool/downloads.rs index a659a8166..7d893d4fb 100644 --- a/zebrad/src/components/mempool/downloads.rs +++ b/zebrad/src/components/mempool/downloads.rs @@ -63,7 +63,7 @@ pub(crate) const TRANSACTION_DOWNLOAD_TIMEOUT: Duration = BLOCK_DOWNLOAD_TIMEOUT /// consistency. /// /// This timeout may lead to denial of service, which will be handled in -/// https://github.com/ZcashFoundation/zebra/issues/2694 +/// [#2694](https://github.com/ZcashFoundation/zebra/issues/2694) pub(crate) const TRANSACTION_VERIFY_TIMEOUT: Duration = BLOCK_VERIFY_TIMEOUT; /// The maximum number of concurrent inbound download and verify tasks.