Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
[frontport] CLI to specify queue ordering strategy (#2494) (#2623)
Browse files Browse the repository at this point in the history
* CLI to specify queue ordering strategy (#2494)

* Alter gas priorities to include gas_price also

* CLI options and tests

* Adding ordering by gas

* whitespace

Conflicts:
	ethcore/src/miner/miner.rs
	ethcore/src/miner/mod.rs
	ethcore/src/miner/transaction_queue.rs
	parity/cli/usage.txt
	parity/configuration.rs

* fix build
  • Loading branch information
tomusdrw authored and gavofyork committed Oct 15, 2016
1 parent 03c1559 commit cceca91
Show file tree
Hide file tree
Showing 11 changed files with 288 additions and 103 deletions.
16 changes: 11 additions & 5 deletions ethcore/src/miner/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use transaction::{Action, SignedTransaction};
use receipt::{Receipt, RichReceipt};
use spec::Spec;
use engines::Engine;
use miner::{MinerService, MinerStatus, TransactionQueue, AccountDetails, TransactionOrigin};
use miner::{MinerService, MinerStatus, TransactionQueue, PrioritizationStrategy, AccountDetails, TransactionOrigin};
use miner::work_notify::WorkPoster;
use client::TransactionImportResult;
use miner::price_info::PriceInfo;
Expand Down Expand Up @@ -76,6 +76,8 @@ pub struct MinerOptions {
pub tx_gas_limit: U256,
/// Maximum size of the transaction queue.
pub tx_queue_size: usize,
/// Strategy to use for prioritizing transactions in the queue.
pub tx_queue_strategy: PrioritizationStrategy,
/// Whether we should fallback to providing all the queue's transactions or just pending.
pub pending_set: PendingSet,
/// How many historical work packages can we store before running out?
Expand All @@ -94,12 +96,13 @@ impl Default for MinerOptions {
reseal_on_external_tx: false,
reseal_on_own_tx: true,
tx_gas_limit: !U256::zero(),
tx_queue_size: 2048,
tx_queue_size: 1024,
tx_queue_gas_limit: GasLimit::Auto,
tx_queue_strategy: PrioritizationStrategy::GasFactorAndGasPrice,
pending_set: PendingSet::AlwaysQueue,
reseal_min_period: Duration::from_secs(2),
work_queue_size: 20,
enable_resubmission: true,
tx_queue_gas_limit: GasLimit::Auto,
}
}
}
Expand Down Expand Up @@ -212,7 +215,9 @@ impl Miner {
GasLimit::Fixed(ref limit) => *limit,
_ => !U256::zero(),
};
let txq = Arc::new(Mutex::new(TransactionQueue::with_limits(options.tx_queue_size, gas_limit, options.tx_gas_limit)));
let txq = Arc::new(Mutex::new(TransactionQueue::with_limits(
options.tx_queue_strategy, options.tx_queue_size, gas_limit, options.tx_gas_limit
)));
Miner {
transaction_queue: txq,
next_allowed_reseal: Mutex::new(Instant::now()),
Expand Down Expand Up @@ -1029,7 +1034,7 @@ impl MinerService for Miner {
mod tests {

use std::time::Duration;
use super::super::MinerService;
use super::super::{MinerService, PrioritizationStrategy};
use super::*;
use util::*;
use ethkey::{Generator, Random};
Expand Down Expand Up @@ -1083,6 +1088,7 @@ mod tests {
tx_gas_limit: !U256::zero(),
tx_queue_size: 1024,
tx_queue_gas_limit: GasLimit::None,
tx_queue_strategy: PrioritizationStrategy::GasFactorAndGasPrice,
pending_set: PendingSet::AlwaysSealing,
work_queue_size: 5,
enable_resubmission: true,
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/miner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod transaction_queue;
mod work_notify;
mod price_info;

pub use self::transaction_queue::{TransactionQueue, AccountDetails, TransactionOrigin};
pub use self::transaction_queue::{TransactionQueue, PrioritizationStrategy, AccountDetails, TransactionOrigin};
pub use self::miner::{Miner, MinerOptions, PendingSet, GasPricer, GasPriceCalibratorOptions, GasLimit};
pub use self::external::{ExternalMiner, ExternalMinerService};
pub use client::TransactionImportResult;
Expand Down
Loading

0 comments on commit cceca91

Please sign in to comment.