diff --git a/ethcore/src/miner/miner.rs b/ethcore/src/miner/miner.rs index 803706c56..8743edff3 100644 --- a/ethcore/src/miner/miner.rs +++ b/ethcore/src/miner/miner.rs @@ -44,6 +44,8 @@ pub enum PendingSet { /// Configures the behaviour of the miner. #[derive(Debug)] pub struct MinerOptions { + /// URLs to notify when there is new work. + pub new_work_notify: Vec, /// Force the miner to reseal, even when nobody has asked for work. pub force_sealing: bool, /// Reseal on receipt of new external transactions. @@ -61,6 +63,7 @@ pub struct MinerOptions { impl Default for MinerOptions { fn default() -> Self { MinerOptions { + new_work_notify: vec![], force_sealing: false, reseal_on_external_tx: true, reseal_on_own_tx: true, diff --git a/parity/cli.rs b/parity/cli.rs index 27578df73..a8e53eeff 100644 --- a/parity/cli.rs +++ b/parity/cli.rs @@ -162,6 +162,8 @@ Sealing/Mining Options: more than 32 characters. --tx-queue-size LIMIT Maximum amount of transactions in the queue (waiting to be included in next block) [default: 1024]. + --notify-work URLS URLs to which work package notifications are pushed. + URLS should be a comma-delimited list of HTTP URLs. Footprint Options: --tracing BOOL Indicates if full transaction tracing should be @@ -311,6 +313,7 @@ pub struct Args { pub flag_gas_cap: String, pub flag_extra_data: Option, pub flag_tx_queue_size: usize, + pub flag_work_notify: Option, pub flag_logging: Option, pub flag_version: bool, pub flag_from: String, diff --git a/parity/configuration.rs b/parity/configuration.rs index 121d40e6e..aebea8e61 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -83,6 +83,10 @@ impl Configuration { ) } + pub fn work_notify(&self) -> Vec { + self.args.flag_work_notify.as_ref().map_or_else(Vec::new, |s| s.split(',').map(|s| s.to_owned()).collect()) + } + pub fn miner_options(&self) -> MinerOptions { let (own, ext) = match self.args.flag_reseal_on_txs.as_str() { "none" => (false, false), @@ -92,6 +96,7 @@ impl Configuration { x => die!("{}: Invalid value for --reseal option. Use --help for more information.", x) }; MinerOptions { + new_work_notify: self.work_notify(), force_sealing: self.args.flag_force_sealing, reseal_on_external_tx: ext, reseal_on_own_tx: own,