Update SF to latest spec (#1386)

* Introduce whitelist for softfork

* Use extradata for fork id.

* Fix condition.
This commit is contained in:
Gav Wood 2016-06-22 15:37:25 +02:00 committed by GitHub
parent 11314a660d
commit 353b9e91e6
2 changed files with 22 additions and 12 deletions

View File

@ -226,6 +226,11 @@ impl State {
// dao attack soft fork // dao attack soft fork
if engine.schedule(&env_info).reject_dao_transactions { if engine.schedule(&env_info).reject_dao_transactions {
let whitelisted = if let Action::Call(to) = t.action {
to == Address::from("Da4a4626d3E16e094De3225A751aAb7128e96526") ||
to == Address::from("2ba9D006C1D72E67A70b5526Fc6b4b0C0fd6D334")
} else { false };
if !whitelisted {
// collect all the addresses which have changed. // collect all the addresses which have changed.
let addresses = self.cache.borrow().iter().map(|(addr, _)| addr.clone()).collect::<Vec<_>>(); let addresses = self.cache.borrow().iter().map(|(addr, _)| addr.clone()).collect::<Vec<_>>();
@ -239,6 +244,7 @@ impl State {
} }
} }
} }
}
// TODO uncomment once to_pod() works correctly. // TODO uncomment once to_pod() works correctly.
// trace!("Applied transaction. Diff:\n{}\n", state_diff::diff_pod(&old, &self.to_pod())); // trace!("Applied transaction. Diff:\n{}\n", state_diff::diff_pod(&old, &self.to_pod()));

View File

@ -121,12 +121,16 @@ impl Configuration {
} }
pub fn extra_data(&self) -> Bytes { pub fn extra_data(&self) -> Bytes {
if !self.args.flag_dont_help_rescue_dao {
(b"rescuedao"[..]).to_owned()
} else {
match self.args.flag_extradata.as_ref().or(self.args.flag_extra_data.as_ref()) { match self.args.flag_extradata.as_ref().or(self.args.flag_extra_data.as_ref()) {
Some(ref x) if x.len() <= 32 => x.as_bytes().to_owned(), Some(ref x) if x.len() <= 32 => x.as_bytes().to_owned(),
None => version_data(), None => version_data(),
Some(ref x) => { die!("{}: Extra data must be at most 32 characters.", x); } Some(ref x) => { die!("{}: Extra data must be at most 32 characters.", x); }
} }
} }
}
pub fn spec(&self) -> Spec { pub fn spec(&self) -> Spec {
match self.chain().as_str() { match self.chain().as_str() {