Remove panickers from trie iterators (#2209)

* port trie iterators to use error handling

* use new trie iterators in snapshot

allows proper recovery from a premature periodic snapshot
This commit is contained in:
Robert Habermeier
2016-09-21 12:56:13 +02:00
committed by Gav Wood
parent 8c111da70b
commit a100b9d09e
9 changed files with 62 additions and 37 deletions

View File

@@ -52,8 +52,9 @@ impl StateProducer {
// modify existing accounts.
let mut accounts_to_modify: Vec<_> = {
let trie = TrieDB::new(&*db, &self.state_root).unwrap();
let temp = trie.iter() // binding required due to complicated lifetime stuff
let temp = trie.iter().unwrap() // binding required due to complicated lifetime stuff
.filter(|_| rng.gen::<f32>() < ACCOUNT_CHURN)
.map(Result::unwrap)
.map(|(k, v)| (H256::from_slice(&k), v.to_owned()))
.collect();