Skip to content

Commit

Permalink
Scott S review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrippled committed Nov 17, 2023
1 parent 4ad9cbf commit 4c54ff3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ripple/consensus/Consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -1870,14 +1870,17 @@ Consensus<Adaptor>::updateOurPositions(bool const share)
votesByCloseTime.insert({voteCount, closeTime});
ss << closeTime.time_since_epoch().count() << ':' << voteCount;
}
// These always gets populated because currPeerPositions_ is not
// empty to end up here, so at least 1 close time has at least 1 vote.
assert(!currPeerPositions_.empty());
std::optional<int> maxVote;
std::set<NetClock::time_point> maxCloseTimes;
// Highest vote getter is last. Track each close time that is tied
// with the highest.
for (auto rit = votesByCloseTime.crbegin();
rit != votesByCloseTime.crend(); ++rit)
{
int const& voteCount = rit->first;
int const voteCount = rit->first;
if (!maxVote.has_value())
maxVote = voteCount;
else if (voteCount < *maxVote)
Expand Down Expand Up @@ -1919,7 +1922,7 @@ Consensus<Adaptor>::updateOurPositions(bool const share)
consensusCloseTime = bestCloseTime;
ss << "Close time " << bestCloseTime.time_since_epoch().count() << " has " <<
*maxVote << " votes, which is >= the threshold (" << threshVote
<< " to make that our positions if it isn't already.";
<< " to make that our position if it isn't already.";
if (*maxVote >= threshConsensus)
{
haveCloseTimeConsensus_ = true;
Expand Down

0 comments on commit 4c54ff3

Please sign in to comment.