Introduce more optional features in ethcore (#9020)

* Make work-notify an optional feature

* More optional ethcore features: price-info, stratum

* Make ethcore features part of dependency instead of local features

* Put cfg gate in right location

* Feature gate register function on work-notify
This commit is contained in:
John-John Tedro
2018-07-05 07:19:59 +02:00
committed by Afri Schoedon
parent 3db353f356
commit 71bbcd54ff
12 changed files with 163 additions and 83 deletions

View File

@@ -24,7 +24,8 @@ use ethereum_types::{U256, Address};
use futures_cpupool::CpuPool;
use hash_fetch::fetch::Client as FetchClient;
use journaldb::Algorithm;
use miner::gas_pricer::{GasPricer, GasPriceCalibratorOptions};
use miner::gas_pricer::GasPricer;
use miner::gas_price_calibrator::{GasPriceCalibratorOptions, GasPriceCalibrator};
use parity_version::version_data;
use user_defaults::UserDefaults;
@@ -248,12 +249,14 @@ impl GasPricerConfig {
GasPricerConfig::Fixed(u) => GasPricer::Fixed(u),
GasPricerConfig::Calibrated { usd_per_tx, recalibration_period, .. } => {
GasPricer::new_calibrated(
GasPriceCalibratorOptions {
usd_per_tx: usd_per_tx,
recalibration_period: recalibration_period,
},
fetch,
p,
GasPriceCalibrator::new(
GasPriceCalibratorOptions {
usd_per_tx: usd_per_tx,
recalibration_period: recalibration_period,
},
fetch,
p,
)
)
}
}

View File

@@ -31,6 +31,7 @@ use ethcore::verification::queue::VerifierSettings;
use ethcore_logger::{Config as LogConfig, RotatingLogger};
use ethcore_service::ClientService;
use sync::{self, SyncConfig};
#[cfg(feature = "work-notify")]
use miner::work_notify::WorkPoster;
use futures_cpupool::CpuPool;
use hash_fetch::{self, fetch};
@@ -529,11 +530,16 @@ fn execute_impl<Cr, Rr>(cmd: RunCmd, logger: Arc<RotatingLogger>, on_client_rq:
miner.set_author(cmd.miner_extras.author, None).expect("Fails only if password is Some; password is None; qed");
miner.set_gas_range_target(cmd.miner_extras.gas_range_target);
miner.set_extra_data(cmd.miner_extras.extra_data);
if !cmd.miner_extras.work_notify.is_empty() {
miner.add_work_listener(Box::new(
WorkPoster::new(&cmd.miner_extras.work_notify, fetch.clone(), event_loop.remote())
));
#[cfg(feature = "work-notify")]
{
if !cmd.miner_extras.work_notify.is_empty() {
miner.add_work_listener(Box::new(
WorkPoster::new(&cmd.miner_extras.work_notify, fetch.clone(), event_loop.remote())
));
}
}
let engine_signer = cmd.miner_extras.engine_signer;
if engine_signer != Default::default() {
// Check if engine signer exists