register the watcher as a ChainNotify

This commit is contained in:
Robert Habermeier 2016-09-02 18:48:07 +02:00
parent e3749b3bc4
commit 1c450f616d
1 changed files with 13 additions and 0 deletions

View File

@ -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 {