diff --git a/src/account.rs b/src/account.rs index 995f1c71e..cd951b15c 100644 --- a/src/account.rs +++ b/src/account.rs @@ -73,5 +73,13 @@ impl Account { }{ self.code = new_code; } + + // that nasty bit of code should really be: + /*if let HashOrData::Data(ref d) = self.code { + let h = db.insert(d); + self.code = HashOrData::Both(h, d.clone()); + }*/ + // a rewrite it closer to this would be good... + } } diff --git a/src/state.rs b/src/state.rs index 86331a5af..5225c56ac 100644 --- a/src/state.rs +++ b/src/state.rs @@ -64,6 +64,7 @@ impl State { /// Commit accounts to TrieDB. This is simplified version of /// cpp-ethereum's dev::eth::commit. + /// accounts mutable because we may need to commit the code or storage and record that. pub fn commit(db: &mut HashDB, mut root: H256, accounts: &mut HashMap) -> H256 { // first, commit the sub trees. for (_, ref mut account) in accounts.iter_mut() { @@ -86,7 +87,7 @@ impl State { } pub fn insert_accounts(&mut self, accounts: &mut HashMap) { - let r = self.root.clone(); + let r = self.root.clone(); // would prefer not to do this, really. self.root = Self::commit(&mut self.db, r, accounts); } }