Broken build

This commit is contained in:
Gav Wood 2015-12-17 21:12:35 +01:00
parent 58d8f13913
commit ffd10d3373
2 changed files with 4 additions and 5 deletions

View File

@ -96,7 +96,7 @@ impl Account {
_ => {} _ => {}
} }
// fetch - cannot be done in match because of the borrow rules. // fetch - cannot be done in match because of the borrow rules.
let t = TrieDBMut::new_existing(db, &mut self.storage_root); let t = TrieDB::new(db, &self.storage_root);
let r = H256::from_slice(t.get(key.bytes()).unwrap_or(&[0u8;32][..])); let r = H256::from_slice(t.get(key.bytes()).unwrap_or(&[0u8;32][..]));
self.storage_overlay.insert(key, r.clone()); self.storage_overlay.insert(key, r.clone());
r r

View File

@ -61,7 +61,7 @@ impl State {
pub fn new_existing(mut db: OverlayDB, mut root: H256, account_start_nonce: U256) -> State { pub fn new_existing(mut db: OverlayDB, mut root: H256, account_start_nonce: U256) -> State {
{ {
// trie should panic! if root does not exist // trie should panic! if root does not exist
let _ = TrieDBMut::new_existing(&mut db, &mut root); let _ = TrieDB::new(&mut db, &mut root);
} }
State { State {
@ -164,8 +164,7 @@ impl State {
fn get(&mut self, a: &Address, require_code: bool) -> Option<&Account> { fn get(&mut self, a: &Address, require_code: bool) -> Option<&Account> {
if self.cache.get(a).is_none() { if self.cache.get(a).is_none() {
// load from trie. // load from trie.
let t = TrieDBMut::new_existing(&mut self.db, &mut self.root); self.cache.insert(a.clone(), TrieDB::new(&self.db, &self.root).get(&a).map(|rlp| Account::from_rlp(rlp)));
self.cache.insert(a.clone(), t.get(&a).map(|rlp| { println!("RLP: {:?}", rlp); Account::from_rlp(rlp) }));
} }
let db = &self.db; let db = &self.db;
@ -182,7 +181,7 @@ impl State {
fn require(&mut self, a: &Address, require_code: bool) -> &mut Account { fn require(&mut self, a: &Address, require_code: bool) -> &mut Account {
if self.cache.get(a).is_none() { if self.cache.get(a).is_none() {
// load from trie. // load from trie.
self.cache.insert(a.clone(), TrieDBMut::new(&mut self.db, &mut self.root).get(&a).map(|rlp| Account::from_rlp(rlp))); self.cache.insert(a.clone(), TrieDB::new(&self.db, &self.root).get(&a).map(|rlp| Account::from_rlp(rlp)));
} }
if self.cache.get(a).unwrap().is_none() { if self.cache.get(a).unwrap().is_none() {