Skip to content
Prev Previous commit
Next Next commit
fix: resulting vector in GetProjectedMNPayees grows to the weighted c…
…ount, should reserve memory accordingly
  • Loading branch information
UdjinM6 authored and knst committed Oct 26, 2023
commit 2ca24de7a7168064e8237c45e7fb8efcd3b5f732
5 changes: 3 additions & 2 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,11 @@ std::vector<CDeterministicMNCPtr> CDeterministicMNList::GetProjectedMNPayees(con
if (nCount < 0 ) {
return {};
}
nCount = std::min(nCount, int(GetValidWeightedMNsCount()));
const auto weighted_count = GetValidWeightedMNsCount();
nCount = std::min(nCount, int(weighted_count));

std::vector<CDeterministicMNCPtr> result;
result.reserve(nCount);
result.reserve(weighted_count);

auto remaining_evo_payments = 0;
CDeterministicMNCPtr evo_to_be_skipped = nullptr;
Expand Down