From 1c450f616d59b8a001e22b892e7476a016f7883f Mon Sep 17 00:00:00 2001 From: Robert Habermeier Date: Fri, 2 Sep 2016 18:48:07 +0200 Subject: [PATCH] register the watcher as a ChainNotify --- parity/run.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/parity/run.rs b/parity/run.rs index 71995cd5f..2d619d350 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -28,6 +28,7 @@ use ethcore::client::{Mode, Switch, DatabaseCompactionProfile, VMType, ChainNoti use ethcore::service::ClientService; use ethcore::account_provider::AccountProvider; use ethcore::miner::{Miner, MinerService, ExternalMiner, MinerOptions}; +use ethcore::snapshot; use ethsync::SyncConfig; use informant::Informant; @@ -46,6 +47,9 @@ use rpc_apis; use rpc; use url; +const SNAPSHOT_PERIOD: u64 = 10000; +const SNAPSHOT_HISTORY: u64 = 1000; + #[derive(Debug, PartialEq)] pub struct RunCmd { pub cache_config: CacheConfig, @@ -249,6 +253,15 @@ pub fn execute(cmd: RunCmd) -> Result<(), String> { }); service.register_io_handler(io_handler).expect("Error registering IO handler"); + let watcher = snapshot::Watcher::new( + service.client(), + service.io().channel(), + SNAPSHOT_PERIOD, + SNAPSHOT_HISTORY, + ); + + service.add_notify(Arc::new(watcher)); + // start ui if cmd.ui { if !cmd.dapps_conf.enabled {