Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
KEP-904: Caught up node doesn't switch to current view number
Browse files Browse the repository at this point in the history
  • Loading branch information
paularchard committed Dec 12, 2018
1 parent e19f966 commit b8741f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions pbft/pbft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ pbft::checkpoint_reached_locally(uint64_t sequence)

this->broadcast(this->wrap_message(cp_msg));

this->maybe_stabilize_checkpoint(*cp);
this->maybe_stabilize_checkpoint(*cp, cp_msg);
}

void
Expand All @@ -868,7 +868,7 @@ pbft::handle_checkpoint(const pbft_msg& msg, const bzn_envelope& original_msg)
checkpoint_t cp(msg.sequence(), msg.state_hash());

this->unstable_checkpoint_proofs[cp][original_msg.sender()] = original_msg.SerializeAsString();
this->maybe_stabilize_checkpoint(cp);
this->maybe_stabilize_checkpoint(cp, msg);
}

bzn::checkpoint_t
Expand All @@ -890,7 +890,7 @@ pbft::unstable_checkpoints_count() const
}

void
pbft::maybe_stabilize_checkpoint(const checkpoint_t& cp)
pbft::maybe_stabilize_checkpoint(const checkpoint_t& cp, const pbft_msg& msg)
{
if (this->unstable_checkpoint_proofs[cp].size() < this->quorum_size())
{
Expand All @@ -904,6 +904,7 @@ pbft::maybe_stabilize_checkpoint(const checkpoint_t& cp)
else
{
// we don't have this checkpoint, so we need to catch up
this->view = msg.view();
this->request_checkpoint_state(cp);
}
}
Expand Down
2 changes: 1 addition & 1 deletion pbft/pbft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace bzn
void notify_audit_failure_detected();

void checkpoint_reached_locally(uint64_t sequence);
void maybe_stabilize_checkpoint(const checkpoint_t& cp);
void maybe_stabilize_checkpoint(const checkpoint_t& cp, const pbft_msg& msg);
void stabilize_checkpoint(const checkpoint_t& cp);
const peer_address_t& select_peer_for_checkpoint(const checkpoint_t& cp);
void request_checkpoint_state(const checkpoint_t& cp);
Expand Down

0 comments on commit b8741f2

Please sign in to comment.