Allow specifying local accounts via CLI (#9960)

* Allow specifying local accounts via CLI

 * Add `tx-queue-locals` CLI option
 * ethcore: modify miner to check options vec before importing transaction
 * modify tests (ethcore/parity)
Resolves #9634

* fix formatting

* fixes: Make prefer HashSet over Vec<>, add test, comment formatting

* Update ethcore/src/miner/miner.rs

Co-Authored-By: insipx <aplaza@liquidthink.net>

* Fix comments and add helper for set->vec conversion

* remove blank line from use statement

* fix helper test

* formatting

* fix test to pass on nightly

* revert test fix for nightly
This commit is contained in:
Andrew Plaza
2019-01-28 05:26:11 -05:00
committed by Afri Schoedon
parent 94db961975
commit 50f5ccc4f2
5 changed files with 75 additions and 4 deletions

View File

@@ -18,6 +18,9 @@
mod usage;
mod presets;
use std::collections::HashSet;
use super::helpers;
usage! {
{
// CLI subcommands
@@ -769,6 +772,10 @@ usage! {
"--tx-queue-per-sender=[LIMIT]",
"Maximum number of transactions per sender in the queue. By default it's 1% of the entire queue, but not less than 16.",
ARG arg_tx_queue_locals: (Option<String>) = None, or |c: &Config| helpers::join_set(c.mining.as_ref()?.tx_queue_locals.as_ref()),
"--tx-queue-locals=[ACCOUNTS]",
"Specify local accounts for which transactions are prioritized in the queue. ACCOUNTS is a comma-delimited list of addresses.",
ARG arg_tx_queue_strategy: (String) = "gas_price", or |c: &Config| c.mining.as_ref()?.tx_queue_strategy.clone(),
"--tx-queue-strategy=[S]",
"Prioritization strategy used to order transactions in the queue. S may be: gas_price - Prioritize txs with high gas price",
@@ -1356,6 +1363,7 @@ struct Mining {
tx_queue_size: Option<usize>,
tx_queue_per_sender: Option<usize>,
tx_queue_mem_limit: Option<u32>,
tx_queue_locals: Option<HashSet<String>>,
tx_queue_strategy: Option<String>,
tx_queue_ban_count: Option<u16>,
tx_queue_ban_time: Option<u16>,
@@ -1799,6 +1807,7 @@ mod tests {
arg_tx_queue_size: 8192usize,
arg_tx_queue_per_sender: None,
arg_tx_queue_mem_limit: 4u32,
arg_tx_queue_locals: Some("0xdeadbeefcafe0000000000000000000000000000".into()),
arg_tx_queue_strategy: "gas_factor".into(),
arg_tx_queue_ban_count: Some(1u16),
arg_tx_queue_ban_time: Some(180u16),
@@ -2072,6 +2081,7 @@ mod tests {
tx_queue_size: Some(8192),
tx_queue_per_sender: None,
tx_queue_mem_limit: None,
tx_queue_locals: None,
tx_queue_strategy: None,
tx_queue_ban_count: None,
tx_queue_ban_time: None,

View File

@@ -129,6 +129,7 @@ price_update_period = "hourly"
gas_floor_target = "8000000"
gas_cap = "10000000"
tx_queue_size = 8192
tx_queue_locals = ["0xdeadbeefcafe0000000000000000000000000000"]
tx_queue_strategy = "gas_factor"
tx_queue_ban_count = 1
tx_queue_ban_time = 180 #s