llmq: Avoid endless loop in GetQuorumRelayMembers (#4796)

* llmq: Avoid endless loop in GetQuorumRelayMembers

regtest quorums can be tiny

* minimize changes, add a note
This commit is contained in:
UdjinM6 2022-04-26 20:22:56 +03:00 committed by GitHub
parent cb75351543
commit b8c9eec34f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -588,6 +588,12 @@ std::set<uint256> CLLMQUtils::GetQuorumRelayMembers(const Consensus::LLMQParams&
std::set<uint256> result;
auto calcOutbound = [&](size_t i, const uint256& proTxHash) {
if (mns.size() == 1) {
// No outbound connections are needed when there is one MN only.
// Also note that trying to calculate results via the algorithm below
// would result in an endless loop.
return std::set<uint256>();
}
// Relay to nodes at indexes (i+2^k)%n, where
// k: 0..max(1, floor(log2(n-1))-1)
// n: size of the quorum/ring