mixed merge and changes...
This commit is contained in:
@@ -67,7 +67,8 @@ usd_per_eth = "auto"
|
||||
price_update_period = "hourly"
|
||||
gas_floor_target = "4700000"
|
||||
gas_cap = "6283184"
|
||||
tx_queue_size = 1024
|
||||
tx_queue_size = 2048
|
||||
tx_queue_gas = "auto"
|
||||
tx_gas_limit = "6283184"
|
||||
extra_data = "Parity"
|
||||
remove_solved = false
|
||||
|
||||
@@ -41,6 +41,7 @@ reseal_on_txs = "all"
|
||||
reseal_min_period = 4000
|
||||
price_update_period = "hourly"
|
||||
tx_queue_size = 2048
|
||||
tx_queue_gas = "auto"
|
||||
|
||||
[footprint]
|
||||
tracing = "on"
|
||||
|
||||
@@ -193,8 +193,10 @@ usage! {
|
||||
or |c: &Config| otry!(c.mining).gas_cap.clone(),
|
||||
flag_extra_data: Option<String> = None,
|
||||
or |c: &Config| otry!(c.mining).extra_data.clone().map(Some),
|
||||
flag_tx_queue_size: usize = 1024usize,
|
||||
flag_tx_queue_size: usize = 2048usize,
|
||||
or |c: &Config| otry!(c.mining).tx_queue_size.clone(),
|
||||
flag_tx_queue_gas: String = "auto",
|
||||
or |c: &Config| otry!(c.mining).tx_queue_gas.clone(),
|
||||
flag_remove_solved: bool = false,
|
||||
or |c: &Config| otry!(c.mining).remove_solved.clone(),
|
||||
flag_notify_work: Option<String> = None,
|
||||
@@ -348,6 +350,7 @@ struct Mining {
|
||||
gas_cap: Option<String>,
|
||||
extra_data: Option<String>,
|
||||
tx_queue_size: Option<usize>,
|
||||
tx_queue_gas: Option<String>,
|
||||
remove_solved: Option<bool>,
|
||||
notify_work: Option<Vec<String>>,
|
||||
}
|
||||
@@ -522,7 +525,8 @@ mod tests {
|
||||
flag_gas_floor_target: "4700000".into(),
|
||||
flag_gas_cap: "6283184".into(),
|
||||
flag_extra_data: Some("Parity".into()),
|
||||
flag_tx_queue_size: 1024usize,
|
||||
flag_tx_queue_size: 2048usize,
|
||||
flag_tx_queue_gas: "auto".into(),
|
||||
flag_remove_solved: false,
|
||||
flag_notify_work: Some("http://localhost:3001".into()),
|
||||
|
||||
@@ -673,6 +677,7 @@ mod tests {
|
||||
gas_floor_target: None,
|
||||
gas_cap: None,
|
||||
tx_queue_size: Some(2048),
|
||||
tx_queue_gas: Some("auto".into()),
|
||||
tx_gas_limit: None,
|
||||
extra_data: None,
|
||||
remove_solved: None,
|
||||
|
||||
@@ -44,7 +44,8 @@ Account Options:
|
||||
ACCOUNTS is a comma-delimited list of addresses.
|
||||
Implies --no-signer. (default: {flag_unlock:?})
|
||||
--password FILE Provide a file containing a password for unlocking
|
||||
an account. (default: {flag_password:?})
|
||||
an account. Leading and trailing whitespace is trimmed.
|
||||
(default: {flag_password:?})
|
||||
--keys-iterations NUM Specify the number of iterations to use when
|
||||
deriving key from the password (bigger is more
|
||||
secure) (default: {flag_keys_iterations}).
|
||||
@@ -183,6 +184,10 @@ Sealing/Mining Options:
|
||||
more than 32 characters. (default: {flag_extra_data:?})
|
||||
--tx-queue-size LIMIT Maximum amount of transactions in the queue (waiting
|
||||
to be included in next block) (default: {flag_tx_queue_size}).
|
||||
--tx-queue-gas LIMIT Maximum amount of total gas for external transactions in
|
||||
the queue. LIMIT can be either an amount of gas or
|
||||
'auto' or 'off'. 'auto' sets the limit to be 2x
|
||||
the current block gas limit. (default: {flag_tx_queue_gas}).
|
||||
--remove-solved Move solved blocks from the work package queue
|
||||
instead of cloning them. This gives a slightly
|
||||
faster import speed, but means that extra solutions
|
||||
|
||||
@@ -30,7 +30,7 @@ use rpc::{IpcConfiguration, HttpConfiguration};
|
||||
use ethcore_rpc::NetworkSettings;
|
||||
use cache::CacheConfig;
|
||||
use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, replace_home,
|
||||
geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address};
|
||||
geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_gas_limit};
|
||||
use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, SpecType};
|
||||
use ethcore_logger::Config as LogConfig;
|
||||
use dir::Directories;
|
||||
@@ -125,7 +125,7 @@ impl Configuration {
|
||||
ImportFromGethAccounts {
|
||||
to: dirs.keys,
|
||||
testnet: self.args.flag_testnet
|
||||
}
|
||||
}
|
||||
);
|
||||
Cmd::Account(account_cmd)
|
||||
} else if self.args.cmd_wallet {
|
||||
@@ -348,6 +348,7 @@ impl Configuration {
|
||||
None => U256::max_value(),
|
||||
},
|
||||
tx_queue_size: self.args.flag_tx_queue_size,
|
||||
tx_queue_gas_limit: try!(to_gas_limit(&self.args.flag_tx_queue_gas)),
|
||||
pending_set: try!(to_pending_set(&self.args.flag_relay_set)),
|
||||
reseal_min_period: Duration::from_millis(self.args.flag_reseal_min_period),
|
||||
work_queue_size: self.args.flag_work_queue_size,
|
||||
|
||||
@@ -22,7 +22,7 @@ use std::fs::File;
|
||||
use util::{clean_0x, U256, Uint, Address, path, CompactionProfile};
|
||||
use util::journaldb::Algorithm;
|
||||
use ethcore::client::{Mode, BlockID, VMType, DatabaseCompactionProfile, ClientConfig};
|
||||
use ethcore::miner::PendingSet;
|
||||
use ethcore::miner::{PendingSet, GasLimit};
|
||||
use cache::CacheConfig;
|
||||
use dir::DatabaseDirectories;
|
||||
use upgrade::upgrade;
|
||||
@@ -93,6 +93,14 @@ pub fn to_pending_set(s: &str) -> Result<PendingSet, String> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_gas_limit(s: &str) -> Result<GasLimit, String> {
|
||||
match s {
|
||||
"auto" => Ok(GasLimit::Auto),
|
||||
"off" => Ok(GasLimit::None),
|
||||
other => Ok(GasLimit::Fixed(try!(to_u256(other)))),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_address(s: Option<String>) -> Result<Address, String> {
|
||||
match s {
|
||||
Some(ref a) => clean_0x(a).parse().map_err(|_| format!("Invalid address: {:?}", a)),
|
||||
@@ -273,9 +281,10 @@ pub fn password_prompt() -> Result<String, String> {
|
||||
pub fn password_from_file<P>(path: P) -> Result<String, String> where P: AsRef<Path> {
|
||||
let mut file = try!(File::open(path).map_err(|_| "Unable to open password file."));
|
||||
let mut file_content = String::new();
|
||||
try!(file.read_to_string(&mut file_content).map_err(|_| "Unable to read password file."));
|
||||
// remove eof
|
||||
Ok((&file_content[..file_content.len() - 1]).to_owned())
|
||||
match file.read_to_string(&mut file_content) {
|
||||
Ok(_) => Ok(file_content.trim().into()),
|
||||
Err(_) => Err("Unable to read password file.".into()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads passwords from files. Treats each line as a separate password.
|
||||
@@ -294,10 +303,13 @@ pub fn passwords_from_files(files: Vec<String>) -> Result<Vec<String>, String> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::time::Duration;
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use devtools::RandomTempPath;
|
||||
use util::{U256};
|
||||
use ethcore::client::{Mode, BlockID};
|
||||
use ethcore::miner::PendingSet;
|
||||
use super::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_address, to_addresses, to_price, geth_ipc_path, to_bootnodes};
|
||||
use super::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_address, to_addresses, to_price, geth_ipc_path, to_bootnodes, password_from_file};
|
||||
|
||||
#[test]
|
||||
fn test_to_duration() {
|
||||
@@ -380,6 +392,14 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_password() {
|
||||
let path = RandomTempPath::new();
|
||||
let mut file = File::create(path.as_path()).unwrap();
|
||||
file.write_all(b"a bc ").unwrap();
|
||||
assert_eq!(password_from_file(path).unwrap().as_bytes(), b"a bc");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(feature = "dev", allow(float_cmp))]
|
||||
fn test_to_price() {
|
||||
|
||||
@@ -196,6 +196,9 @@ fn sync_main() -> bool {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// Always print backtrace on panic.
|
||||
::std::env::set_var("RUST_BACKTRACE", "1");
|
||||
|
||||
if sync_main() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,8 +68,9 @@ pub type SyncModules = (Arc<SyncProvider>, Arc<ManageNetwork>, Arc<ChainNotify>)
|
||||
|
||||
#[cfg(feature="ipc")]
|
||||
mod ipc_deps {
|
||||
pub use ethsync::{SyncClient, NetworkManagerClient, ServiceConfiguration};
|
||||
pub use ethcore::client::ChainNotifyClient;
|
||||
pub use ethsync::remote::{SyncClient, NetworkManagerClient};
|
||||
pub use ethsync::ServiceConfiguration;
|
||||
pub use ethcore::client::remote::ChainNotifyClient;
|
||||
pub use hypervisor::{SYNC_MODULE_ID, BootArgs, HYPERVISOR_IPC_URL};
|
||||
pub use nanoipc::{GuardedSocket, NanoSocket, generic_client, fast_client};
|
||||
pub use ipc::IpcSocket;
|
||||
|
||||
@@ -206,7 +206,7 @@ impl Default for MinerExtras {
|
||||
extra_data: version_data(),
|
||||
gas_floor_target: U256::from(4_700_000),
|
||||
gas_ceil_target: U256::from(6_283_184),
|
||||
transactions_limit: 1024,
|
||||
transactions_limit: 2048,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use hypervisor::{SYNC_MODULE_ID, HYPERVISOR_IPC_URL, ControlService};
|
||||
use ethcore::client::{RemoteClient, ChainNotify};
|
||||
use ethcore::snapshot::{RemoteSnapshotService};
|
||||
use ethcore::client::ChainNotify;
|
||||
use ethcore::client::remote::RemoteClient;
|
||||
use ethcore::snapshot::remote::RemoteSnapshotService;
|
||||
use ethsync::{SyncProvider, EthSync, ManageNetwork, ServiceConfiguration};
|
||||
use modules::service_urls;
|
||||
use boot;
|
||||
|
||||
Reference in New Issue
Block a user