Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(script): skip duplicate txids for reindexing pointers #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Workers/Tasks/ReindexInscriptionsPointers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async function main() {
log(`total inscriptions: ${total} \n`);

let count = 0;
const indexedSet = new Set<string>();

const cursor = db.inscriptions.collection.find({}, { sort: { _id: -1 } });
while (await cursor.hasNext()) {
Expand All @@ -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 {
Expand All @@ -73,6 +80,7 @@ async function main() {
}
}
count += 1;
indexedSet.add(inscription.genesis);
}
}

Expand Down