From a9776beca6b06f5ab381d099445fd8dec1722193 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 10 Apr 2024 19:39:40 +0800 Subject: [PATCH] fix(script): skip duplicate txids for reindexing pointers --- src/Workers/Tasks/ReindexInscriptionsPointers.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Workers/Tasks/ReindexInscriptionsPointers.ts b/src/Workers/Tasks/ReindexInscriptionsPointers.ts index 80751c64..c08f69ea 100644 --- a/src/Workers/Tasks/ReindexInscriptionsPointers.ts +++ b/src/Workers/Tasks/ReindexInscriptionsPointers.ts @@ -45,6 +45,7 @@ async function main() { log(`total inscriptions: ${total} \n`); let count = 0; + const indexedSet = new Set(); const cursor = db.inscriptions.collection.find({}, { sort: { _id: -1 } }); while (await cursor.hasNext()) { @@ -55,6 +56,12 @@ async function main() { log(`count: ${count}, inscription id: ${inscription.id} \n`); + if (indexedSet.has(inscription.genesis)) { + log(`txid already indexed: ${inscription.genesis}, skipping inscription \n`); + count += 1; + continue; + } + // try to reindex the transaction if the index 1 exist let ordData: InscriptionData | undefined; try { @@ -73,6 +80,7 @@ async function main() { } } count += 1; + indexedSet.add(inscription.genesis); } }