mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-27 08:08:15 -05:00
fix(tree): avoid holding two locks simultaneously (#10843)
This commit is contained in:
@@ -113,10 +113,8 @@ impl InMemoryState {
|
||||
|
||||
/// Returns the current chain head state.
|
||||
pub(crate) fn head_state(&self) -> Option<Arc<BlockState>> {
|
||||
self.numbers
|
||||
.read()
|
||||
.last_key_value()
|
||||
.and_then(|(_, hash)| self.blocks.read().get(hash).cloned())
|
||||
let hash = *self.numbers.read().last_key_value()?.1;
|
||||
self.state_by_hash(hash)
|
||||
}
|
||||
|
||||
/// Returns the pending state corresponding to the current head plus one,
|
||||
|
||||
Reference in New Issue
Block a user