From 233f19d23da32ea942dc18a696f11b9a7ef9bc64 Mon Sep 17 00:00:00 2001 From: Mononaut Date: Thu, 18 Apr 2024 13:26:58 +0000 Subject: [PATCH] Fix audit blockIndex increment bug --- backend/src/api/audit.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/api/audit.ts b/backend/src/api/audit.ts index fb0d05baa..4d05870e8 100644 --- a/backend/src/api/audit.ts +++ b/backend/src/api/audit.ts @@ -75,10 +75,6 @@ class Audit { let failures = 0; let blockIndex = 1; while (projectedBlocks[blockIndex] && failures < 500) { - if (index >= projectedBlocks[blockIndex].transactionIds.length) { - index = 0; - blockIndex++; - } const txid = projectedBlocks[blockIndex].transactionIds[index]; const tx = mempool[txid]; if (tx) { @@ -102,6 +98,10 @@ class Audit { logger.warn('projected transaction missing from mempool cache'); } index++; + if (index >= projectedBlocks[blockIndex].transactionIds.length) { + index = 0; + blockIndex++; + } } // mark unexpected transactions in the mined block as 'added'