Use lower quorum for smaller validator sets

This commit is contained in:
wilsonianb
2017-03-09 17:40:34 -08:00
committed by seelabs
parent 69bc58c5f6
commit ffc7cf8f6c
3 changed files with 97 additions and 4 deletions

View File

@@ -408,4 +408,16 @@ ValidatorList::for_each_listed (
func (v.first, trusted(v.first));
}
std::size_t
ValidatorList::calculateQuorum (std::size_t nTrustedKeys)
{
// Use 80% for large values of n, but have special cases for small numbers.
constexpr std::array<std::size_t, 10> quorum{{ 0, 1, 2, 2, 3, 3, 4, 5, 6, 7 }};
if (nTrustedKeys < quorum.size())
return quorum[nTrustedKeys];
return nTrustedKeys - nTrustedKeys / 5;
}
} // ripple