Skip to content

Commit

Permalink
fix: create Newview on startup and error log proposal failures
Browse files Browse the repository at this point in the history
  • Loading branch information
86667 committed Feb 3, 2025
1 parent d5fb267 commit 5ce9464
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions zilliqa/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,9 @@ impl Consensus {
peers.add_peers(recent_peer_ids);
}

// Build NewView so that we can immediately contribute to consensus moving along if it has halted
consensus.build_new_view()?;

Ok(consensus)
}

Expand Down Expand Up @@ -506,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 5ce9464

Please sign in to comment.