From 4a7bcfe4f06b55e84fca1fd4126ecce111cae3c6 Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Tue, 27 Jun 2017 22:40:46 +0200 Subject: [PATCH] CLI: Export error message and less verbose peer counter. (#5870) * Removed numbed of active connections from informant * Print error message when fatdb is required * Remove peers from UI --- js/src/views/Application/Status/status.js | 2 +- parity/blockchain.rs | 12 +++++++++--- parity/informant.rs | 3 +-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/js/src/views/Application/Status/status.js b/js/src/views/Application/Status/status.js index a9efcdb93..a86543420 100644 --- a/js/src/views/Application/Status/status.js +++ b/js/src/views/Application/Status/status.js @@ -49,7 +49,7 @@ class Status extends Component { { netChain }
- { netPeers.active.toFormat() }/{ netPeers.connected.toFormat() }/{ netPeers.max.toFormat() } peers + { netPeers.connected.toFormat() }/{ netPeers.max.toFormat() } peers
diff --git a/parity/blockchain.rs b/parity/blockchain.rs index fe34fa56c..17e486b5b 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -315,7 +315,8 @@ fn start_client( fat_db: Switch, compaction: DatabaseCompactionProfile, wal: bool, - cache_config: CacheConfig + cache_config: CacheConfig, + require_fat_db: bool, ) -> Result { // load spec file @@ -343,6 +344,9 @@ fn start_client( // check if fatdb is on let fat_db = fatdb_switch_to_bool(fat_db, &user_defaults, algorithm)?; + if !fat_db && require_fat_db { + return Err("This command requires Parity to be synced with --fat-db on.".to_owned()); + } // prepare client and snapshot paths. let client_path = db_dirs.client_path(algorithm); @@ -395,7 +399,8 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> { cmd.fat_db, cmd.compaction, cmd.wal, - cmd.cache_config + cmd.cache_config, + false, )?; let format = cmd.format.unwrap_or_default(); @@ -435,7 +440,8 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> { cmd.fat_db, cmd.compaction, cmd.wal, - cmd.cache_config + cmd.cache_config, + true )?; let client = service.client(); diff --git a/parity/informant.rs b/parity/informant.rs index 1f309848c..3dfd5147d 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -158,7 +158,7 @@ impl Informant { false => String::new(), }, match (&sync_status, &network_config) { - (&Some(ref sync_info), &Some(ref net_config)) => format!("{}{}/{}/{} peers", + (&Some(ref sync_info), &Some(ref net_config)) => format!("{}{}/{} peers", match importing { true => format!("{} ", paint(Green.bold(), format!("{:>8}", format!("#{}", sync_info.last_imported_block_number.unwrap_or(chain_info.best_block_number))))), false => match sync_info.last_imported_old_block_number { @@ -166,7 +166,6 @@ impl Informant { None => String::new(), } }, - paint(Cyan.bold(), format!("{:2}", sync_info.num_active_peers)), paint(Cyan.bold(), format!("{:2}", sync_info.num_peers)), paint(Cyan.bold(), format!("{:2}", sync_info.current_max_peers(net_config.min_peers, net_config.max_peers))), ),