From a955da067ed48b39b45c3009acd8e60039a26fb0 Mon Sep 17 00:00:00 2001 From: Nima Rasooli Date: Fri, 31 Jan 2025 00:09:51 +0100 Subject: [PATCH] fix: bug in calculation of the next id in getDebtPerInterestRateAscending --- contracts/src/MultiTroveGetter.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/src/MultiTroveGetter.sol b/contracts/src/MultiTroveGetter.sol index a102cdec3..7357bb753 100644 --- a/contracts/src/MultiTroveGetter.sol +++ b/contracts/src/MultiTroveGetter.sol @@ -126,7 +126,7 @@ contract MultiTroveGetter is IMultiTroveGetter { assert(address(sortedTroves) != address(0)); data = new DebtPerInterestRate[](_maxIterations); - currId = sortedTroves.getPrev(_startId); + currId = _startId == 0 ? sortedTroves.getPrev(_startId) : _startId; for (uint256 i = 0; i < _maxIterations; ++i) { if (currId == 0) break;