Skip to content

Commit

Permalink
refactor: remove DB access when generate Journal
Browse files Browse the repository at this point in the history
  • Loading branch information
jjyr committed Nov 2, 2022
1 parent cac1e4e commit 9b089e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/store/src/state/state_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl<S: CodeStore> CodeStore for StateDB<S> {
fn insert_script(&mut self, script_hash: H256, script: packed::Script) {
self.journal.push(JournalEntry::InsertScript {
script_hash,
prev_exist: self.get_script(&script_hash).is_some(),
prev_exist: self.dirty_scripts.contains_key(&script_hash),
});
self.dirty_scripts.insert(script_hash, script);
}
Expand All @@ -480,7 +480,7 @@ impl<S: CodeStore> CodeStore for StateDB<S> {
}
self.journal.push(JournalEntry::InsertData {
data_hash,
prev_exist: self.get_data(&data_hash).is_some(),
prev_exist: self.dirty_data.contains_key(&data_hash),
});
self.dirty_data.insert(data_hash, code);
}
Expand Down

0 comments on commit 9b089e4

Please sign in to comment.