Skip to content

Commit

Permalink
[FOLD] divide by zero fix
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelportilla committed Jun 26, 2020
1 parent 76096ae commit 0fbeb2e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/ripple/app/ledger/impl/LedgerMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,14 +1088,16 @@ LedgerMaster::checkAccept(std::shared_ptr<Ledger const> const& ledger)
// We report only if (1) we have accumulated validation messages
// from 90% validators from the UNL, and (2) 60% of validators
// running the rippled implementation have higher version numbers.
constexpr std::size_t reportingPercent = 90;
constexpr std::size_t cutoffPercent = 60;
needPrint = calculatePercent(
vals.size(),
app_.validators().getQuorumKeys().second.size()) >=
reportingPercent &&
calculatePercent(higherVersionCount, rippledCount) >=
cutoffPercent;
if (higherVersionCount > 0)
{
constexpr std::size_t reportingPercent = 90;
constexpr std::size_t cutoffPercent = 60;
auto const sz{app_.validators().getQuorumKeys().second.size()};
needPrint = sz > 0 &&
calculatePercent(vals.size(), sz) >= reportingPercent &&
calculatePercent(higherVersionCount, rippledCount) >=
cutoffPercent;
}
}
// To throttle the warning messages, instead of printing a warning
// every flag ledger, we print every week.
Expand Down

0 comments on commit 0fbeb2e

Please sign in to comment.