Limit transaction pool size (#1676)

* Avoid excessive hashing. Store extrinsic len.

* Implement pool limits.

* Fix issues.

* Make sure we return error in case it doesn't make into the pool.

* Pass parameters from CLI.

* Remove redundant todo.

* Fix tests.
This commit is contained in:
Tomasz Drwięga
2019-02-06 19:03:05 +01:00
committed by Gav Wood
parent 461cd384fc
commit 4e3eace15f
14 changed files with 398 additions and 38 deletions
+15
View File
@@ -109,6 +109,17 @@ pub struct NetworkConfigurationParams {
pub in_peers: u32,
}
/// Parameters used to create the pool configuration.
#[derive(Debug, StructOpt, Clone)]
pub struct TransactionPoolParams {
/// Maximum number of transactions in the transaction pool.
#[structopt(long = "pool-limit", value_name = "COUNT", default_value = "512")]
pub pool_limit: usize,
/// Maximum number of kilobytes of all transactions stored in the pool.
#[structopt(long = "pool-kbytes", value_name = "COUNT", default_value="10240")]
pub pool_kbytes: usize,
}
/// The `run` command used to run a node.
#[derive(Debug, StructOpt, Clone)]
pub struct RunCmd {
@@ -183,6 +194,10 @@ pub struct RunCmd {
#[allow(missing_docs)]
#[structopt(flatten)]
pub network_config: NetworkConfigurationParams,
#[allow(missing_docs)]
#[structopt(flatten)]
pub pool_config: TransactionPoolParams,
}
impl_augment_clap!(RunCmd);