From 3ba60c158a68c9fc4488f5e4efac6506b6784811 Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Tue, 6 Jun 2023 13:25:00 +0200
Subject: [PATCH] fix(1447): Reverting a block should update
 LevelDBSindex.indexForTrimming (and not indexForConditions) - close #1447

---
 app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts b/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts
index a8b4aceba..7d6e836cd 100644
--- a/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts
+++ b/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts
@@ -329,19 +329,14 @@ export class LevelDBSindex extends LevelDBTable<SindexEntry>
     }
   }
 
-  /**
-   * Duplicate with trimConditions?!
-   * @param writtenOn
-   * @param id
-   */
   private async trimWrittenOn(writtenOn: number, id: string) {
     const k = LevelDBSindex.trimWrittenOnKey(writtenOn);
     const existing = await this.getWrittenOnSourceIds(writtenOn);
     const trimmed = arrayPruneAllCopy(existing, id);
     if (trimmed.length) {
-      await this.indexForConditions.put(k, trimmed);
+      await this.indexForTrimming.put(k, trimmed);
     } else {
-      await this.indexForConditions.del(k);
+      await this.indexForTrimming.del(k);
     }
   }
 
-- 
GitLab