Gas limit ceiling option.

This commit is contained in:
Gav Wood
2016-06-23 14:29:16 +02:00
parent 129ce97ad5
commit 8fcec20398
17 changed files with 92 additions and 31 deletions

View File

@@ -137,6 +137,8 @@ Sealing/Mining Options:
good value [default: auto].
--gas-floor-target GAS Amount of gas per block to target when sealing a new
block [default: 3141592].
--gas-cap GAS A cap on how large we will raise the gas limit per
block due to transaction volume [default: 3141592].
--author ADDRESS Specify the block author (aka "coinbase") address
for sending block rewards from sealed blocks
[default: 0037a6b811ffeb6e072da21179d11b1406371c63].
@@ -283,6 +285,7 @@ pub struct Args {
pub flag_usd_per_tx: String,
pub flag_usd_per_eth: String,
pub flag_gas_floor_target: String,
pub flag_gas_cap: String,
pub flag_extra_data: Option<String>,
pub flag_tx_limit: usize,
pub flag_logging: Option<String>,

View File

@@ -85,7 +85,16 @@ impl Configuration {
}
}
pub fn gas_ceil_target(&self) -> U256 {
if self.args.flag_dont_help_rescue_dao || self.args.flag_dogmatic {
10_000_000.into()
} else {
let d = &self.args.flag_gas_cap;
U256::from_dec_str(d).unwrap_or_else(|_| {
die!("{}: Invalid target gas ceiling given. Must be a decimal unsigned 256-bit number.", d)
})
}
}
pub fn gas_price(&self) -> U256 {
match self.args.flag_gasprice.as_ref() {

View File

@@ -211,6 +211,7 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig)
let miner = Miner::with_accounts(conf.args.flag_force_sealing, conf.spec(), account_service.clone());
miner.set_author(conf.author());
miner.set_gas_floor_target(conf.gas_floor_target());
miner.set_gas_ceil_target(conf.gas_ceil_target());
miner.set_extra_data(conf.extra_data());
miner.set_minimal_gas_price(conf.gas_price());
miner.set_transactions_limit(conf.args.flag_tx_limit);