diff --git a/src/ripple/consensus/Consensus.h b/src/ripple/consensus/Consensus.h index bc843316448..f7ebcb6e509 100644 --- a/src/ripple/consensus/Consensus.h +++ b/src/ripple/consensus/Consensus.h @@ -1870,6 +1870,9 @@ Consensus::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 maxVote; std::set maxCloseTimes; // Highest vote getter is last. Track each close time that is tied @@ -1877,7 +1880,7 @@ Consensus::updateOurPositions(bool const share) 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) @@ -1919,7 +1922,7 @@ Consensus::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;