Provide CLI options to disable aspects of soft-fork.

Soft-fork will remain default behaviour, but you can now disable
either the whole mechanism (you'll lose money if you mine with this
when the majority network doesn't) or just vote against it but
otherwise go with the flow.
This commit is contained in:
Gav Wood
2016-06-19 13:20:14 +02:00
parent 026bfd6741
commit 2245baaaab
8 changed files with 26774 additions and 14 deletions

View File

@@ -42,12 +42,20 @@ Protocol Options:
[default: $HOME/.parity/keys].
--identity NAME Specify your node's name.
DAO-Rescue Soft-fork Options:
--rescue-my-ether Does nothing - on by default.
--assist-dao-attack Votes against the DAO-rescue soft-fork, but supports
it if it is triggered anyway.
Equivalent to --gas-floor-target=3141592.
--dogmatic Ignores all DAO-rescue soft-fork behaviour. Even if
it means losing mining rewards.
Account Options:
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.
ACCOUNTS is a comma-delimited list of addresses.
--password FILE Provide a file containing a password for unlocking
an account.
--keys-iterations NUM Specify the number of iterations to use when
--keys-iterations NUM Specify the number of iterations to use when
deriving key from the password (bigger is more
secure) [default: 10240].
--no-import-keys Do not import keys from legacy clients.
@@ -220,6 +228,8 @@ pub struct Args {
pub flag_chain: String,
pub flag_db_path: String,
pub flag_identity: String,
pub flag_assist_dao_attack: bool,
pub flag_dogmatic: bool,
pub flag_unlock: Option<String>,
pub flag_password: Vec<String>,
pub flag_cache: Option<usize>,

View File

@@ -75,12 +75,18 @@ impl Configuration {
}
pub fn gas_floor_target(&self) -> U256 {
let d = &self.args.flag_gas_floor_target;
U256::from_dec_str(d).unwrap_or_else(|_| {
die!("{}: Invalid target gas floor given. Must be a decimal unsigned 256-bit number.", d)
})
if self.args.flag_assist_dao_attack || self.args.flag_dogmatic {
4_700_000.into()
} else {
let d = &self.args.flag_gas_floor_target;
U256::from_dec_str(d).unwrap_or_else(|_| {
die!("{}: Invalid target gas floor given. Must be a decimal unsigned 256-bit number.", d)
})
}
}
pub fn gas_price(&self) -> U256 {
match self.args.flag_gasprice.as_ref() {
Some(d) => {
@@ -124,7 +130,7 @@ impl Configuration {
pub fn spec(&self) -> Spec {
match self.chain().as_str() {
"frontier" | "homestead" | "mainnet" => ethereum::new_frontier(),
"frontier" | "homestead" | "mainnet" => ethereum::new_frontier(!self.args.flag_dogmatic),
"morden" | "testnet" => ethereum::new_morden(),
"olympic" => ethereum::new_olympic(),
f => Spec::load(contents(f).unwrap_or_else(|_| {