Ensure Spec::ensure_db_good() places DB entries for code & storage.

This commit is contained in:
Gav Wood
2016-01-26 15:00:22 +01:00
parent 7065c477a4
commit 387e3ec3fd
12 changed files with 66 additions and 13 deletions

View File

@@ -25,6 +25,12 @@ impl<'db> SecTrieDBMut<'db> {
pub fn from_existing(db: &'db mut HashDB, root: &'db mut H256) -> Self {
SecTrieDBMut { raw: TrieDBMut::from_existing(db, root) }
}
/// Get the backing database.
pub fn db(&'db self) -> &'db HashDB { self.raw.db() }
/// Get the backing database.
pub fn db_mut(&'db mut self) -> &'db mut HashDB { self.raw.db_mut() }
}
impl<'db> Trie for SecTrieDBMut<'db> {

View File

@@ -87,6 +87,11 @@ impl<'db> TrieDBMut<'db> {
self.db
}
/// Get the backing database.
pub fn db_mut(&'db mut self) -> &'db mut HashDB {
self.db
}
/// Determine all the keys in the backing database that belong to the trie.
pub fn keys(&self) -> Vec<H256> {
let mut ret: Vec<H256> = Vec::new();