Style
This commit is contained in:
parent
755ee95326
commit
a87edc2557
@ -62,6 +62,7 @@ impl State {
|
|||||||
self.snapshots.borrow_mut().push(HashMap::new());
|
self.snapshots.borrow_mut().push(HashMap::new());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Merge last snapshot with previous
|
||||||
pub fn clear_snapshot(&mut self) {
|
pub fn clear_snapshot(&mut self) {
|
||||||
// merge with previous snapshot
|
// merge with previous snapshot
|
||||||
let last = self.snapshots.borrow_mut().pop();
|
let last = self.snapshots.borrow_mut().pop();
|
||||||
@ -74,6 +75,7 @@ impl State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Revert to snapshot
|
||||||
pub fn revert_snapshot(&mut self) {
|
pub fn revert_snapshot(&mut self) {
|
||||||
if let Some(mut snapshot) = self.snapshots.borrow_mut().pop() {
|
if let Some(mut snapshot) = self.snapshots.borrow_mut().pop() {
|
||||||
for (k, v) in snapshot.drain() {
|
for (k, v) in snapshot.drain() {
|
||||||
@ -89,7 +91,6 @@ impl State {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn insert_cache(&self, address: &Address, account: Option<Account>) {
|
fn insert_cache(&self, address: &Address, account: Option<Account>) {
|
||||||
if let Some(ref mut snapshot) = self.snapshots.borrow_mut().last_mut() {
|
if let Some(ref mut snapshot) = self.snapshots.borrow_mut().last_mut() {
|
||||||
if !snapshot.contains_key(&address) {
|
if !snapshot.contains_key(&address) {
|
||||||
|
@ -130,9 +130,10 @@ impl JournalDB {
|
|||||||
last = r.drain();
|
last = r.drain();
|
||||||
&last
|
&last
|
||||||
})) {
|
})) {
|
||||||
|
let to_add;
|
||||||
let rlp = Rlp::new(&rlp_data);
|
let rlp = Rlp::new(&rlp_data);
|
||||||
{
|
{
|
||||||
let to_add: Vec<H256> = rlp.val_at(1);
|
to_add = rlp.val_at(1);
|
||||||
for i in &to_add {
|
for i in &to_add {
|
||||||
let delete_counter = {
|
let delete_counter = {
|
||||||
if let Some(mut cnt) = counters.get_mut(i) {
|
if let Some(mut cnt) = counters.get_mut(i) {
|
||||||
@ -147,7 +148,7 @@ impl JournalDB {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let to_remove: Vec<H256> = rlp.val_at(if canon_id == rlp.val_at(0) {2} else {1});
|
let to_remove: Vec<H256> = if canon_id == rlp.val_at(0) {rlp.val_at(2)} else {to_add};
|
||||||
for i in &to_remove {
|
for i in &to_remove {
|
||||||
if !counters.contains_key(i) {
|
if !counters.contains_key(i) {
|
||||||
batch.delete(&i).expect("Low-level database error. Some issue with your hard disk?");
|
batch.delete(&i).expect("Low-level database error. Some issue with your hard disk?");
|
||||||
|
Loading…
Reference in New Issue
Block a user