Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid pointless work
  • Loading branch information
gavofyork committed Feb 13, 2018
commit 38cd36a00bb6f68cb33437c617ce7da45e1eb9d8
6 changes: 5 additions & 1 deletion substrate/state-machine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ impl OverlayedChanges {

/// Commit prospective changes to state.
pub fn commit_prospective(&mut self) {
self.committed.update(self.prospective.storage.drain());
if self.committed.storage.is_empty() {
::std::mem::swap(&mut self.prospective, &mut self.committed);
} else {
self.committed.update(self.prospective.storage.drain());
}
}

/// Drain prospective changes to an iterator.
Expand Down