Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit b914912

Browse files
sorpaasdebris
authored andcommitted
Fix bugfix hard fork logic (#9138)
* Fix bugfix hard fork logic * Remove dustProtectionTransition from bugfix category EIP-168 is not enabled by default * Remove unnecessary 'static
1 parent 0ce0484 commit b914912

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

ethcore/src/miner/miner.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -1088,10 +1088,12 @@ impl miner::MinerService for Miner {
10881088

10891089
// refuse to seal the first block of the chain if it contains hard forks
10901090
// which should be on by default.
1091-
if block.block().header().number() == 1 && self.engine.params().contains_bugfix_hard_fork() {
1092-
warn!("Your chain specification contains one or more hard forks which are required to be \
1093-
on by default. Please remove these forks and start your chain again.");
1094-
return;
1091+
if block.block().header().number() == 1 {
1092+
if let Some(name) = self.engine.params().nonzero_bugfix_hard_fork() {
1093+
warn!("Your chain specification contains one or more hard forks which are required to be \
1094+
on by default. Please remove these forks and start your chain again: {}.", name);
1095+
return;
1096+
}
10951097
}
10961098

10971099
match self.engine.seals_internally() {

ethcore/src/spec/spec.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn fmt_err<F: ::std::fmt::Display>(f: F) -> String {
5757

5858
/// Parameters common to ethereum-like blockchains.
5959
/// NOTE: when adding bugfix hard-fork parameters,
60-
/// add to `contains_bugfix_hard_fork`
60+
/// add to `nonzero_bugfix_hard_fork`
6161
///
6262
/// we define a "bugfix" hard fork as any hard fork which
6363
/// you would put on-by-default in a new chain.
@@ -188,13 +188,21 @@ impl CommonParams {
188188
}
189189
}
190190

191-
/// Whether these params contain any bug-fix hard forks.
192-
pub fn contains_bugfix_hard_fork(&self) -> bool {
193-
self.eip98_transition != 0 && self.eip155_transition != 0 &&
194-
self.validate_receipts_transition != 0 && self.eip86_transition != 0 &&
195-
self.eip140_transition != 0 && self.eip210_transition != 0 &&
196-
self.eip211_transition != 0 && self.eip214_transition != 0 &&
197-
self.validate_chain_id_transition != 0 && self.dust_protection_transition != 0
191+
/// Return Some if the current parameters contain a bugfix hard fork not on block 0.
192+
pub fn nonzero_bugfix_hard_fork(&self) -> Option<&str> {
193+
if self.eip155_transition != 0 {
194+
return Some("eip155Transition");
195+
}
196+
197+
if self.validate_receipts_transition != 0 {
198+
return Some("validateReceiptsTransition");
199+
}
200+
201+
if self.validate_chain_id_transition != 0 {
202+
return Some("validateChainIdTransition");
203+
}
204+
205+
None
198206
}
199207
}
200208

0 commit comments

Comments
 (0)