Skip to content

Commit

Permalink
Merge branch 'master' into feature/allow-DA-blocks-to-be-received-out…
Browse files Browse the repository at this point in the history
…-of-order
  • Loading branch information
MitchTurner authored Oct 30, 2024
2 parents d2b3c28 + ec41f56 commit 128a9ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- [2366](https://github.com/FuelLabs/fuel-core/pull/2366): The `importer_gas_price_for_block` metric is properly collected.
- [2369](https://github.com/FuelLabs/fuel-core/pull/2369): The `transaction_insertion_time_in_thread_pool_milliseconds` metric is properly collected.
- [2413](https://github.com/FuelLabs/fuel-core/issues/2413): block production immediately errors if unable to lock the mutex.

### Changed

Expand Down
10 changes: 7 additions & 3 deletions crates/services/producer/src/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ where
where
Executor: ports::BlockProducer<Vec<Transaction>> + 'static,
{
let _production_guard = self.lock.lock().await;
let _production_guard = self.lock.try_lock().map_err(|_| {
anyhow!("Failed to acquire the production lock, block production is already in progress")
})?;

let mut transactions_source = predefined_block.transactions().to_vec();

Expand Down Expand Up @@ -185,8 +187,10 @@ where
// 2. parallel throughput
// - Execute block with production mode to correctly malleate txs outputs and block headers

// prevent simultaneous block production calls, the guard will drop at the end of this fn.
let _production_guard = self.lock.lock().await;
// prevent simultaneous block production calls
let _production_guard = self.lock.try_lock().map_err(|_| {
anyhow!("Failed to acquire the production lock, block production is already in progress")
})?;

let gas_price = self.calculate_gas_price().await?;

Expand Down

0 comments on commit 128a9ba

Please sign in to comment.