This commit is contained in:
arkpar
2016-02-05 02:08:17 +01:00
parent 755ee95326
commit a87edc2557
2 changed files with 5 additions and 3 deletions

View File

@@ -62,6 +62,7 @@ impl State {
self.snapshots.borrow_mut().push(HashMap::new());
}
/// Merge last snapshot with previous
pub fn clear_snapshot(&mut self) {
// merge with previous snapshot
let last = self.snapshots.borrow_mut().pop();
@@ -74,6 +75,7 @@ impl State {
}
}
/// Revert to snapshot
pub fn revert_snapshot(&mut self) {
if let Some(mut snapshot) = self.snapshots.borrow_mut().pop() {
for (k, v) in snapshot.drain() {
@@ -89,7 +91,6 @@ impl State {
}
}
fn insert_cache(&self, address: &Address, account: Option<Account>) {
if let Some(ref mut snapshot) = self.snapshots.borrow_mut().last_mut() {
if !snapshot.contains_key(&address) {