Skip to content

Commit

Permalink
fix: create NewView on startup and error log proposal failures (#2281)
Browse files Browse the repository at this point in the history
* fix: create Newview on startup and error log proposal failures

* fix: move NewView build so that it only occurs after a view jump
  • Loading branch information
86667 authored Feb 7, 2025
1 parent 4c44d27 commit e9f92c4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions zilliqa/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ impl Consensus {
min_view_since_high_qc_updated
);
consensus.db.set_view(min_view_since_high_qc_updated)?;
// Build NewView so that we can immediately contribute to consensus moving along if it has halted
consensus.build_new_view()?;
}

// Remind block_store of our peers and request any potentially missing blocks
Expand Down Expand Up @@ -507,12 +509,16 @@ impl Consensus {
if self.create_next_block_on_timeout {
// Check if enough time elapsed to propose block
if milliseconds_remaining_of_block_time == 0 {
if let Ok(Some((block, transactions))) = self.propose_new_block() {
self.create_next_block_on_timeout = false;
return Ok(Some((
None,
ExternalMessage::Proposal(Proposal::from_parts(block, transactions)),
)));
match self.propose_new_block() {
Ok(Some((block, transactions))) => {
self.create_next_block_on_timeout = false;
return Ok(Some((
None,
ExternalMessage::Proposal(Proposal::from_parts(block, transactions)),
)));
}
Err(e) => error!("Failed to finalise proposal: {e}"),
_ => {}
};
} else {
self.reset_timeout
Expand Down

0 comments on commit e9f92c4

Please sign in to comment.