From a1857bf1398c42ba419253b5f7a180dd8e47d335 Mon Sep 17 00:00:00 2001 From: debris Date: Thu, 21 Jul 2016 16:50:24 +0200 Subject: [PATCH] cleaning up substate --- ethcore/src/executive.rs | 2 +- ethcore/src/externalities.rs | 7 +------ ethcore/src/substate.rs | 15 +++------------ 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/ethcore/src/executive.rs b/ethcore/src/executive.rs index cc5c1ffde..f5ff95d71 100644 --- a/ethcore/src/executive.rs +++ b/ethcore/src/executive.rs @@ -433,7 +433,7 @@ impl<'a> Executive<'a> { self.state.add_balance(&self.info.author, &fees_value); // perform suicides - for (address, _) in &substate.suicides { + for address in &substate.suicides { self.state.kill_account(address); } diff --git a/ethcore/src/externalities.rs b/ethcore/src/externalities.rs index ae1ae9d3a..493b21611 100644 --- a/ethcore/src/externalities.rs +++ b/ethcore/src/externalities.rs @@ -263,12 +263,7 @@ impl<'a, T, V> Ext for Externalities<'a, T, V> where T: 'a + Tracer, V: 'a + VMT self.state.transfer_balance(&address, refund_address, &balance); } - let details = SuicideDetails { - refund_address: refund_address.clone(), - value: balance, - }; - - self.substate.suicides.insert(address, details); + self.substate.suicides.insert(address); } fn schedule(&self) -> &Schedule { diff --git a/ethcore/src/substate.rs b/ethcore/src/substate.rs index 6cca224a6..de703f369 100644 --- a/ethcore/src/substate.rs +++ b/ethcore/src/substate.rs @@ -15,25 +15,16 @@ // along with Parity. If not, see . //! Execution environment substate. -use std::collections::HashMap; +use std::collections::HashSet; use util::{Address, U256}; use log_entry::LogEntry; -/// Details of the commited suicide. -#[derive(Debug, Default)] -pub struct SuicideDetails { - /// Suicided contract heir. - pub refund_address: Address, - /// Balance of the contract just before suicide. - pub value: U256, -} - /// State changes which should be applied in finalize, /// after transaction is fully executed. #[derive(Debug, Default)] pub struct Substate { /// Any accounts that have suicided. - pub suicides: HashMap, + pub suicides: HashSet
, /// Any logs. pub logs: Vec, @@ -81,7 +72,7 @@ mod tests { data: vec![] }); sub_state.sstore_clears_count = 5.into(); - sub_state.suicides.insert(10u64.into(), Default::default()); + sub_state.suicides.insert(10u64.into()); let mut sub_state_2 = Substate::new(); sub_state_2.contracts_created.push(2u64.into());