Skip to content

Commit

Permalink
Share read lock
Browse files Browse the repository at this point in the history
  • Loading branch information
sydhds committed Nov 30, 2022
1 parent e8cb4ce commit 44568c1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions massa-execution-worker/src/speculative_ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,12 +370,9 @@ impl SpeculativeLedger {
/// `Some(Vec<Vec<u8>>)` for found keys, `None` if the address does not exist.
pub fn get_keys(&self, addr: &Address) -> Option<BTreeSet<Vec<u8>>> {

let mut keys: Option<BTreeSet<Vec<u8>>> = match self.final_state.read().ledger.entry_exists(addr) {
// here, get the final keys from the final ledger
true => self.final_state
.read()
.ledger
.get_datastore_keys(addr),
let read_guard = self.final_state.read();
let mut keys: Option<BTreeSet<Vec<u8>>> = match read_guard.ledger.entry_exists(addr) {
true => read_guard.ledger.get_datastore_keys(addr),
false => None,
};

Expand Down

0 comments on commit 44568c1

Please sign in to comment.