Mempool doc (#2978)

* Fix some links and linewraps

* Flesh out module-level rustdoc for mempool component

* Links for Downloads and Storage

* Tidy rustdoc links

Co-authored-by: Conrado Gouvea <conrado@zfnd.org>
This commit is contained in:
Deirdre Connolly 2021-11-01 10:32:48 -04:00 committed by GitHub
parent e9d2ba835e
commit da8be766dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 12 deletions

View File

@ -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
/// <https://docs.rs/tower/0.4.10/tower/buffer/struct.Buffer.html#a-note-on-choosing-a-bound>
CheckForVerifiedTransactions,
}

View File

@ -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),

View File

@ -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.