mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 14:47:55 +00:00
Avoid pointless work
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user