Cleanups.
This commit is contained in:
parent
53f4b226b9
commit
51e7dd705f
@ -73,5 +73,13 @@ impl Account {
|
|||||||
}{
|
}{
|
||||||
self.code = new_code;
|
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...
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ impl State {
|
|||||||
|
|
||||||
/// Commit accounts to TrieDB. This is simplified version of
|
/// Commit accounts to TrieDB. This is simplified version of
|
||||||
/// cpp-ethereum's dev::eth::commit.
|
/// 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<Address, Account>) -> H256 {
|
pub fn commit(db: &mut HashDB, mut root: H256, accounts: &mut HashMap<Address, Account>) -> H256 {
|
||||||
// first, commit the sub trees.
|
// first, commit the sub trees.
|
||||||
for (_, ref mut account) in accounts.iter_mut() {
|
for (_, ref mut account) in accounts.iter_mut() {
|
||||||
@ -86,7 +87,7 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert_accounts(&mut self, accounts: &mut HashMap<Address, Account>) {
|
pub fn insert_accounts(&mut self, accounts: &mut HashMap<Address, Account>) {
|
||||||
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);
|
self.root = Self::commit(&mut self.db, r, accounts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user