Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix block production race condition in integration test #10009

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/lib/block_producer/block_producer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,28 @@ let run ~logger ~vrf_evaluator ~prover ~verifier ~trust_system
Transition_registry
in
let crumb = Transition_frontier.best_tip frontier in
let crumb =
let crumb_global_slot_since_genesis =
Breadcrumb.protocol_state crumb
|> Protocol_state.consensus_state
|> Consensus.Data.Consensus_state.global_slot_since_genesis
in
let block_global_slot_since_genesis =
Consensus.Proof_of_stake.Data.Block_data
.global_slot_since_genesis block_data
in
if
Mina_numbers.Global_slot.equal crumb_global_slot_since_genesis
block_global_slot_since_genesis
then
(* We received a block for this slot over the network before
attempting to produce our own. Build upon its parent instead
of attempting (and failing) to build upon the block itself.
*)
Transition_frontier.find_exn frontier
(Breadcrumb.parent_hash crumb)
else crumb
in
let start = Time.now time_controller in
[%log info]
~metadata:[ ("breadcrumb", Breadcrumb.to_yojson crumb) ]
Expand Down