sweep most unwraps from ethcore crate, dapps crate (#2762)

* sweep most unwraps from ethcore crate

* purge unwrap from dapps server

* whitespace

[ci:none]
This commit is contained in:
Robert Habermeier
2016-10-20 23:41:15 +02:00
committed by Gav Wood
parent 866ab9c7a3
commit 96f4c10453
31 changed files with 150 additions and 80 deletions

View File

@@ -520,7 +520,7 @@ impl State {
}
{
let mut trie = factories.trie.from_existing(db.as_hashdb_mut(), root).unwrap();
let mut trie = try!(factories.trie.from_existing(db.as_hashdb_mut(), root));
for (address, ref mut a) in accounts.iter_mut().filter(|&(_, ref a)| a.is_dirty()) {
a.state = AccountState::Committed;
match a.account {
@@ -691,14 +691,15 @@ impl State {
}
self.note_cache(a);
match &mut self.cache.borrow_mut().get_mut(a).unwrap().account {
&mut Some(ref mut acc) => not_default(acc),
slot => *slot = Some(default()),
}
// at this point the account is guaranteed to be in the cache.
// at this point the entry is guaranteed to be in the cache.
RefMut::map(self.cache.borrow_mut(), |c| {
let mut entry = c.get_mut(a).unwrap();
let mut entry = c.get_mut(a).expect("entry known to exist in the cache; qed");
match &mut entry.account {
&mut Some(ref mut acc) => not_default(acc),
slot => *slot = Some(default()),
}
// set the dirty flag after changing account data.
entry.state = AccountState::Dirty;
match entry.account {