Replace dev chain special case with preset
Add --min-gas-price (does the same as legacy --gasprice) and tweak gas_pricer_config() and test cases. Dev preset will still be overridden by CLI arguments, including --gasprice.
This commit is contained in:
@@ -101,6 +101,7 @@ reseal_min_period = 4000
|
||||
reseal_max_period = 60000
|
||||
work_queue_size = 20
|
||||
relay_set = "cheap"
|
||||
min_gas_price = ""
|
||||
usd_per_tx = "0.0025"
|
||||
usd_per_eth = "auto"
|
||||
price_update_period = "hourly"
|
||||
|
||||
@@ -269,6 +269,8 @@ usage! {
|
||||
or |c: &Config| otry!(c.mining).tx_time_limit.clone().map(Some),
|
||||
flag_relay_set: String = "cheap",
|
||||
or |c: &Config| otry!(c.mining).relay_set.clone(),
|
||||
flag_min_gas_price: Option<String> = None,
|
||||
or |c: &Config| otry!(c.mining).min_gas_price.clone().map(Some),
|
||||
flag_usd_per_tx: String = "0.0025",
|
||||
or |c: &Config| otry!(c.mining).usd_per_tx.clone(),
|
||||
flag_usd_per_eth: String = "auto",
|
||||
@@ -542,6 +544,7 @@ struct Mining {
|
||||
tx_gas_limit: Option<String>,
|
||||
tx_time_limit: Option<u64>,
|
||||
relay_set: Option<String>,
|
||||
min_gas_price: Option<String>,
|
||||
usd_per_tx: Option<String>,
|
||||
usd_per_eth: Option<String>,
|
||||
price_update_period: Option<String>,
|
||||
@@ -808,6 +811,7 @@ mod tests {
|
||||
flag_tx_gas_limit: Some("6283184".into()),
|
||||
flag_tx_time_limit: Some(100u64),
|
||||
flag_relay_set: "cheap".into(),
|
||||
flag_min_gas_price: Some("".into()),
|
||||
flag_usd_per_tx: "0.0025".into(),
|
||||
flag_usd_per_eth: "auto".into(),
|
||||
flag_price_update_period: "hourly".into(),
|
||||
@@ -1035,6 +1039,7 @@ mod tests {
|
||||
reseal_max_period: Some(60000),
|
||||
work_queue_size: None,
|
||||
relay_set: None,
|
||||
min_gas_price: None,
|
||||
usd_per_tx: None,
|
||||
usd_per_eth: None,
|
||||
price_update_period: Some("hourly".into()),
|
||||
|
||||
6
parity/cli/presets/config.dev.toml
Normal file
6
parity/cli/presets/config.dev.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[parity]
|
||||
chain = "dev"
|
||||
|
||||
[mining]
|
||||
reseal_min_period = 0
|
||||
min_gas_price = "0"
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
pub fn preset_config_string(arg: &str) -> Result<&'static str, &str> {
|
||||
match arg.to_lowercase().as_ref() {
|
||||
"poa" => Ok(include_str!("./config.poa.toml")),
|
||||
"pow" => Ok(include_str!("./config.pow.toml")),
|
||||
"dev" => Ok(include_str!("./config.dev.toml")),
|
||||
_ => Err(arg.clone())
|
||||
}
|
||||
}
|
||||
@@ -295,6 +295,10 @@ Sealing/Mining Options:
|
||||
means we relay nothing if not mining);
|
||||
lenient - Same as strict when mining, and cheap
|
||||
when not (default: {flag_relay_set}).
|
||||
--min-gas-price STRING Minimum amount of Wei per GAS to be paid for a
|
||||
transaction to be accepted for mining. Overrides
|
||||
--basic-tx-usd.
|
||||
(default: {flag_min_gas_price:?})
|
||||
--usd-per-tx USD Amount of USD to be paid for a basic transaction
|
||||
(default: {flag_usd_per_tx}). The minimum gas price is set
|
||||
accordingly.
|
||||
|
||||
Reference in New Issue
Block a user