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:
@@ -41,6 +41,8 @@ pub struct EthashParams {
|
||||
pub registrar: Address,
|
||||
/// Homestead transition block number.
|
||||
pub frontier_compatibility_mode_limit: u64,
|
||||
/// Enable the soft-fork logic.
|
||||
pub dao_rescue_soft_fork: bool,
|
||||
}
|
||||
|
||||
impl From<ethjson::spec::EthashParams> for EthashParams {
|
||||
@@ -53,6 +55,7 @@ impl From<ethjson::spec::EthashParams> for EthashParams {
|
||||
block_reward: p.block_reward.into(),
|
||||
registrar: p.registrar.into(),
|
||||
frontier_compatibility_mode_limit: p.frontier_compatibility_mode_limit.into(),
|
||||
dao_rescue_soft_fork: p.dao_rescue_soft_fork.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -102,7 +105,9 @@ impl Engine for Ethash {
|
||||
Schedule::new_frontier()
|
||||
} else {
|
||||
let mut s = Schedule::new_homestead();
|
||||
s.reject_dao_transactions = env_info.dao_rescue_block_gas_limit.map(|x| x <= 4_000_000.into()).unwrap_or(false);
|
||||
if self.ethash_params.dao_rescue_soft_fork {
|
||||
s.reject_dao_transactions = env_info.dao_rescue_block_gas_limit.map(|x| x <= 4_000_000.into()).unwrap_or(false);
|
||||
}
|
||||
s
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,12 @@ use super::spec::*;
|
||||
pub fn new_olympic() -> Spec { Spec::load(include_bytes!("../../res/ethereum/olympic.json")) }
|
||||
|
||||
/// Create a new Frontier mainnet chain spec.
|
||||
pub fn new_frontier() -> Spec { Spec::load(include_bytes!("../../res/ethereum/frontier.json")) }
|
||||
pub fn new_frontier(dao_rescue: bool) -> Spec {
|
||||
Spec::load(match dao_rescue {
|
||||
true => include_bytes!("../../res/ethereum/frontier_dao_rescue.json"),
|
||||
false => include_bytes!("../../res/ethereum/frontier.json"),
|
||||
})
|
||||
}
|
||||
|
||||
/// Create a new Frontier chain spec as though it never changes to Homestead.
|
||||
pub fn new_frontier_test() -> Spec { Spec::load(include_bytes!("../../res/ethereum/frontier_test.json")) }
|
||||
@@ -84,7 +89,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn frontier() {
|
||||
let frontier = new_frontier();
|
||||
let frontier = new_frontier(true);
|
||||
|
||||
assert_eq!(frontier.state_root(), H256::from_str("d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544").unwrap());
|
||||
let genesis = frontier.genesis_block();
|
||||
|
||||
Reference in New Issue
Block a user