Skip to content

Commit

Permalink
Fix data race in HTTP state API
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsproul committed Apr 26, 2023
1 parent 7456e1e commit 0764ad2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion beacon_node/http_api/src/state_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ impl StateId {
.map_err(BeaconChainError::DBError)
.map_err(warp_utils::reject::beacon_chain_error)?
{
// Check fork choice for the optimistic status, falling back to the finalized
// block's status if the block isn't found. The block may not be found if the
// database has been slow to update its split point, while fork choice has
// already updated and pruned the block.
let execution_optimistic = chain
.canonical_head
.fork_choice_read_lock()
.is_optimistic_or_invalid_block_no_fallback(&hot_summary.latest_block_root)
.is_optimistic_or_invalid_block(&hot_summary.latest_block_root)
.map_err(BeaconChainError::ForkChoiceError)
.map_err(warp_utils::reject::beacon_chain_error)?;
let finalized = chain
Expand Down

0 comments on commit 0764ad2

Please sign in to comment.