Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Renamed merge_with into replace_with
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar committed Oct 6, 2016
1 parent 3b60d68 commit 7855737
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ethcore/src/state/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ impl Account {
/// Replace self with the data from other account merging storage cache.
/// Basic account data and all modifications are overwritten
/// with new values.
pub fn merge_with(&mut self, other: Account) {
pub fn replace_with(&mut self, other: Account) {
self.balance = other.balance;
self.nonce = other.nonce;
self.storage_root = other.storage_root;
Expand Down
6 changes: 3 additions & 3 deletions ethcore/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ impl AccountEntry {
}

// Replace data with another entry but preserve storage cache
fn merge_snapshot(&mut self, other: AccountEntry) {
fn replace_with(&mut self, other: AccountEntry) {
self.state = other.state;
match other.account {
None => self.account = None,
Some(acc) => match self.account {
Some(ref mut ours) => {
ours.merge_with(acc);
ours.replace_with(acc);
},
None => {},
},
Expand Down Expand Up @@ -245,7 +245,7 @@ impl State {
Entry::Occupied(mut e) => {
// Merge snapshotted changes back into the main account
// storage preserving the cache.
e.get_mut().merge_snapshot(v);
e.get_mut().replace_with(v);
},
Entry::Vacant(e) => {
e.insert(v);
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/state_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl StateDB {
for (address, account) in self.cache_overlay.drain(..) {
if let Some(&mut Some(ref mut existing)) = cache.accounts.get_mut(&address) {
if let Some(new) = account {
existing.merge_with(new);
existing.replace_with(new);
continue;
}
}
Expand Down

0 comments on commit 7855737

Please sign in to comment.