From c2a28bd5b84055b84efa8b969db3a89fe0140a77 Mon Sep 17 00:00:00 2001 From: Redm4x <2829180+Redm4x@users.noreply.github.com> Date: Mon, 6 May 2024 10:39:28 -0400 Subject: [PATCH] fix(indexer): fix predictedClosedHeight prediction for multi-lease deployments --- indexer/src/indexers/akashStatsIndexer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indexer/src/indexers/akashStatsIndexer.ts b/indexer/src/indexers/akashStatsIndexer.ts index 06000be86..1dc7c7731 100644 --- a/indexer/src/indexers/akashStatsIndexer.ts +++ b/indexer/src/indexers/akashStatsIndexer.ts @@ -597,7 +597,7 @@ export class AkashStatsIndexer extends Indexer { deployment.closedHeight = height; await deployment.save({ transaction: blockGroupTransaction }); } else { - const predictedClosedHeight = deployment.balance / (blockRate - lease.price); + const predictedClosedHeight = Math.ceil((deployment.lastWithdrawHeight || lease.createdHeight) + deployment.balance / (blockRate - lease.price)); await Lease.update({ predictedClosedHeight: predictedClosedHeight }, { where: { deploymentId: deployment.id }, transaction: blockGroupTransaction }); } }