diff --git a/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts b/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts index a8b4aceba9bf7314135e8a1a47c41b7ad96f7ffd..9744a29d44ca69b928b0c28564f1df2ba94594c3 100644 --- a/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts +++ b/app/lib/dal/indexDAL/leveldb/LevelDBSindex.ts @@ -288,7 +288,8 @@ export class LevelDBSindex extends LevelDBTable<SindexEntry> const updateRecord = await this.getOrNull(updateKey); // Undo consumption if (updateRecord && updateRecord.writtenOn === writtenOn) { - conditions.push(updateRecord.conditions); + // Delete from condition index only if no createRecord exists - fix #1446 + if (!createRecord) conditions.push(updateRecord.conditions); await this.del(updateKey); } // Undo creation? @@ -296,11 +297,10 @@ export class LevelDBSindex extends LevelDBTable<SindexEntry> conditions.push(createRecord.conditions); await this.del(createKey); } - // Update balance - // 1. Conditions + // Update condition index const uniqConditions = Underscore.uniq(conditions); for (const condition of uniqConditions) { - // Remove this source from the balance + // Remove this source from the condition await this.trimConditions(condition, id); } } @@ -324,7 +324,7 @@ export class LevelDBSindex extends LevelDBTable<SindexEntry> // If some sources are left for this "account", persist what remains await this.indexForConditions.put(condition, trimmed); } else { - // Otherwise just delete the "account" + // Otherwise just delete the "condition" await this.indexForConditions.del(condition); } }