Use for..in rather than an indexed loop.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Kris Nuttycombe 2020-07-09 11:40:23 -06:00 committed by GitHub
parent e456d87cbf
commit 7555a7c26a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -103,10 +103,7 @@ void checkNumberOfUniqueAddresses(int nUnique) {
int GetMaxFundingStreamHeight(const Consensus::Params& params) {
int result = 0;
for (uint32_t idx = Consensus::FIRST_FUNDING_STREAM; idx < Consensus::MAX_FUNDING_STREAMS; idx++) {
// The following indexed access is safe as Consensus::MAX_FUNDING_STREAMS is used
// in the definition of vFundingStreams.
auto fs = params.vFundingStreams[idx];
for (auto fs : params.vFundingStreams) {
if (fs && result < fs.get().GetEndHeight() - 1) {
result = fs.get().GetEndHeight() - 1;
}