Introduce options for fine-grained management of work queue. (#1484)

* Introduce options for fine-grained management of work queue.

- Minimum reseal period between non-mandatory (transaction) reseals.
- Maximum historical cached block size.

Defaults changed to reflect real-world scenarios (2s, 20 blocks).

* Fix test bug.

* 50 -> 20.
This commit is contained in:
Gav Wood
2016-06-29 16:26:19 +02:00
committed by GitHub
parent c096c087df
commit 5d1ff3d7ba
4 changed files with 34 additions and 5 deletions

View File

@@ -137,6 +137,13 @@ Sealing/Mining Options:
own - reseal only on a new local transaction;
ext - reseal only on a new external transaction;
all - reseal on all new transactions [default: all].
--reseal-min-period MS Specify the minimum time between reseals from
incoming transactions. MS is time measured in
milliseconds [default: 2000].
--work-queue-size ITEMS Specify the number of historical work packages
which are kept cached lest a solution is found for
them later. High values take more memory but result
in fewer unusable solutions [default: 20].
--tx-gas-limit GAS Apply a limit of GAS as the maximum amount of gas
a single transaction may have for it to be mined.
--relay-set SET Set of transactions to relay. SET may be:
@@ -302,6 +309,8 @@ pub struct Args {
pub flag_no_token: bool,
pub flag_force_sealing: bool,
pub flag_reseal_on_txs: String,
pub flag_reseal_min_period: u64,
pub flag_work_queue_size: usize,
pub flag_tx_gas_limit: Option<String>,
pub flag_relay_set: String,
pub flag_author: Option<String>,

View File

@@ -16,6 +16,7 @@
use std::env;
use std::fs::File;
use std::time::Duration;
use std::io::{BufRead, BufReader};
use std::net::{SocketAddr, IpAddr};
use std::path::PathBuf;
@@ -103,6 +104,8 @@ impl Configuration {
"lenient" => PendingSet::SealingOrElseQueue,
x => die!("{}: Invalid value for --relay-set option. Use --help for more information.", x)
},
reseal_min_period: Duration::from_millis(self.args.flag_reseal_min_period),
work_queue_size: self.args.flag_work_queue_size,
}
}