clear statedb panics (#797)

* state-db: remove the assertion and replace it with Result<>

* state-db: unit test fixes

* comment fixes

* typo fix
This commit is contained in:
Guanqun Lu
2018-09-26 18:23:33 +08:00
committed by Gav Wood
parent 74a5ff7d0d
commit 1438e15925
4 changed files with 60 additions and 46 deletions
+2 -1
View File
@@ -603,7 +603,8 @@ impl<Block> client::backend::Backend<Block, Blake2Hasher> for Backend<Block> whe
}
}
let number_u64 = number.as_();
let commit = self.storage.state_db.insert_block(&hash, number_u64, &pending_block.header.parent_hash(), changeset);
let commit = self.storage.state_db.insert_block(&hash, number_u64, &pending_block.header.parent_hash(), changeset)
.map_err(|e: state_db::Error<io::Error>| client::error::Error::from(format!("State database error: {:?}", e)))?;
apply_state_commit(&mut transaction, commit);
apply_changes_trie_commit(&mut transaction, operation.changes_trie_updates);