Skip to content

Commit

Permalink
Drop txn_lock
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Jun 28, 2022
1 parent 6426347 commit 1603b44
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions beacon_node/beacon_chain/src/beacon_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2936,6 +2936,10 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// fork choice.
match CanonicalHead::load_from_store(&self.store, &self.spec) {
Ok(past_canonical_head) => {
// Drop the transaction lock, it's no longer required and a deadlock risk since we
// may interact with the canonical_head lock again in this code path.
drop(txn_lock);

// Drop the read-lock on the head and then take a write-lock.
//
// We don't care if someone mutates the head between dropping the read-lock and
Expand All @@ -2954,8 +2958,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
}
}
}

drop(txn_lock);
}

// We're declaring the block "imported" at this point, since fork choice and the DB know
Expand Down

0 comments on commit 1603b44

Please sign in to comment.