Skip to content

Commit

Permalink
fix(store): blocking in async fn get_batch_inputs (#705)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko-von-Leipzig authored Feb 19, 2025
1 parent 22f53bd commit fea7a59
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/store/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,7 @@ struct InnerState {
impl InnerState {
/// Returns the latest block number.
fn latest_block_num(&self) -> BlockNumber {
let block_number: u32 = (self.blockchain.chain_tip().as_usize() - 1)
.try_into()
.expect("chain_mmr always has, at least, the genesis block");

block_number.into()
self.blockchain.chain_tip()
}
}

Expand Down Expand Up @@ -638,7 +634,7 @@ impl State {
// Scoped block to automatically drop the read lock guard as soon as we're done.
// We also avoid accessing the db in the block as this would delay dropping the guard.
let (batch_reference_block, partial_mmr) = {
let inner_state = self.inner.blocking_read();
let inner_state = self.inner.read().await;

let latest_block_num = inner_state.blockchain.chain_tip();

Expand Down

0 comments on commit fea7a59

Please sign in to comment.