Add a mempool config section (#2845)
* add mempool config section * change to Duration * fix typo in var name * document consensus rules * tweak var name
This commit is contained in:
parent
dd1f0a6dcc
commit
0683e0b40b
|
|
@ -1,11 +1,14 @@
|
|||
//! Zebra mempool.
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
future::Future,
|
||||
iter,
|
||||
pin::Pin,
|
||||
task::{Context, Poll},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use futures::{future::FutureExt, stream::Stream};
|
||||
|
|
@ -91,6 +94,30 @@ enum ActiveState {
|
|||
},
|
||||
}
|
||||
|
||||
/// Mempool configuration section.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Config {
|
||||
/// The transaction cost limit
|
||||
pub tx_cost_limit: u32,
|
||||
/// Max amount of minutes for transactions to be in recently evicted
|
||||
pub eviction_memory_time: Duration,
|
||||
}
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// https://zips.z.cash/zip-0401#specification
|
||||
impl Default for Config {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
tx_cost_limit: 80_000_000,
|
||||
eviction_memory_time: Duration::from_secs(60 * 60),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Mempool async management and query service.
|
||||
///
|
||||
/// The mempool is the set of all verified transactions that this node is aware
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use std::{net::SocketAddr, path::PathBuf};
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::components::mempool::Config as MempoolSection;
|
||||
use zebra_consensus::Config as ConsensusSection;
|
||||
use zebra_network::Config as NetworkSection;
|
||||
use zebra_state::Config as StateSection;
|
||||
|
|
@ -37,6 +38,9 @@ pub struct ZebradConfig {
|
|||
|
||||
/// Sync configuration
|
||||
pub sync: SyncSection,
|
||||
|
||||
/// Mempool configuration
|
||||
pub mempool: MempoolSection,
|
||||
}
|
||||
|
||||
/// Tracing configuration section.
|
||||
|
|
|
|||
Loading…
Reference in New Issue