Skip to content

Commit

Permalink
fix: only advance blessed number after gap detection
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcr committed Nov 2, 2023
1 parent 8109ce5 commit c8f3c81
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/pg/pg-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ export class PgStore extends BasePgStore {
for (const operation of tx.metadata.ordinal_operations) {
if (operation.inscription_revealed) {
const reveal = operation.inscription_revealed;
if (reveal.inscription_number >= 0 && blessedNumber + 1 !== reveal.inscription_number)
throw Error(
`PgStore inscription gap detected: Attempting to insert #${reveal.inscription_number} (${block_height}) but current max is #${blessedNumber}`
);
blessedNumber = reveal.inscription_number;
if (reveal.inscription_number >= 0) {
if (blessedNumber + 1 !== reveal.inscription_number)
throw Error(
`PgStore inscription gap detected: Attempting to insert #${reveal.inscription_number} (${block_height}) but current max is #${blessedNumber}`
);
blessedNumber = reveal.inscription_number;
}
const satoshi = new OrdinalSatoshi(reveal.ordinal_number);
const satpoint = parseSatPoint(reveal.satpoint_post_inscription);
const recursive_refs = getInscriptionRecursion(reveal.content_bytes);
Expand Down

0 comments on commit c8f3c81

Please sign in to comment.