Skip to content

Commit

Permalink
Emit Decide for genesis
Browse files Browse the repository at this point in the history
  • Loading branch information
shenkeyao committed Feb 5, 2024
1 parent ba8bee5 commit 94d1e3e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions crates/task-impls/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,30 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +

let consensus = self.consensus.upgradable_read().await;

// Construct the leaf.
// Get the parent leaf.
let parent = if justify_qc.is_genesis {
self.genesis_leaf().await
// Send the `Decide` event for the genesis block if the justify QC is genesis.
let leaf = self.genesis_leaf().await;
match leaf {
Some(ref leaf) => {
self.output_event_stream
.publish(Event {
view_number: TYPES::Time::genesis(),
event: EventType::Decide {
leaf_chain: Arc::new(vec![leaf.clone()]),
qc: Arc::new(justify_qc.clone()),
block_size: None,
},
})
.await;
}
None => {
error!(
"Failed to find the genesis leaf while the justify QC is genesis."
);
}
}
leaf
} else {
consensus
.saved_leaves
Expand Down

0 comments on commit 94d1e3e

Please sign in to comment.