Backporting to stable (#6060)

* --reseal-on-uncle (#5940)

* --reseal-on-uncle

* Optimized uncle check

* Additional uncle check

* Updated comment

* v1.6.9

* 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
This commit is contained in:
Arkadiy Paronyan
2017-07-14 17:42:36 +02:00
committed by GitHub
parent 823f207d25
commit 1f176c7798
19 changed files with 109 additions and 44 deletions

View File

@@ -319,7 +319,8 @@ fn start_client(
fat_db: Switch,
compaction: DatabaseCompactionProfile,
wal: bool,
cache_config: CacheConfig
cache_config: CacheConfig,
require_fat_db: bool,
) -> Result<ClientService, String> {
// load spec file
@@ -347,6 +348,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);
@@ -399,7 +403,8 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
cmd.fat_db,
cmd.compaction,
cmd.wal,
cmd.cache_config
cmd.cache_config,
false,
)?;
let panic_handler = PanicHandler::new_in_arc();
let format = cmd.format.unwrap_or_default();
@@ -442,7 +447,8 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> {
cmd.fat_db,
cmd.compaction,
cmd.wal,
cmd.cache_config
cmd.cache_config,
true
)?;
let panic_handler = PanicHandler::new_in_arc();

View File

@@ -224,6 +224,8 @@ usage! {
or |c: &Config| otry!(c.mining).force_sealing.clone(),
flag_reseal_on_txs: String = "own",
or |c: &Config| otry!(c.mining).reseal_on_txs.clone(),
flag_reseal_on_uncle: bool = false,
or |c: &Config| otry!(c.mining).reseal_on_uncle.clone(),
flag_reseal_min_period: u64 = 2000u64,
or |c: &Config| otry!(c.mining).reseal_min_period.clone(),
flag_work_queue_size: usize = 20usize,
@@ -461,6 +463,7 @@ struct Mining {
author: Option<String>,
engine_signer: Option<String>,
force_sealing: Option<bool>,
reseal_on_uncle: Option<bool>,
reseal_on_txs: Option<String>,
reseal_min_period: Option<u64>,
work_queue_size: Option<usize>,
@@ -705,6 +708,7 @@ mod tests {
flag_force_sealing: true,
flag_reseal_on_txs: "all".into(),
flag_reseal_min_period: 4000u64,
flag_reseal_on_uncle: false,
flag_work_queue_size: 20usize,
flag_tx_gas_limit: Some("6283184".into()),
flag_tx_time_limit: Some(100u64),
@@ -904,6 +908,7 @@ mod tests {
engine_signer: Some("0xdeadbeefcafe0000000000000000000000000001".into()),
force_sealing: Some(true),
reseal_on_txs: Some("all".into()),
reseal_on_uncle: None,
reseal_min_period: Some(4000),
work_queue_size: None,
relay_set: None,

View File

@@ -221,6 +221,9 @@ Sealing/Mining Options:
ext - reseal only on a new external transaction;
all - reseal on all new transactions
(default: {flag_reseal_on_txs}).
--reseal-on-uncle Force the node to author new blocks when a new uncle
block is imported.
(default: {flag_reseal_on_uncle})
--reseal-min-period MS Specify the minimum time between reseals from
incoming transactions. MS is time measured in
milliseconds (default: {flag_reseal_min_period}).

View File

@@ -506,6 +506,7 @@ impl Configuration {
force_sealing: self.args.flag_force_sealing,
reseal_on_external_tx: reseal.external,
reseal_on_own_tx: reseal.own,
reseal_on_uncle: self.args.flag_reseal_on_uncle,
tx_gas_limit: match self.args.flag_tx_gas_limit {
Some(ref d) => to_u256(d)?,
None => U256::max_value(),

View File

@@ -159,7 +159,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 {
@@ -167,7 +167,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))),
),