Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit e3ceece

Browse files
authored
fix: add env var to toggle continuity check (#381)
1 parent 2ea16aa commit e3ceece

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/env.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ const schema = Type.Object({
5757
),
5858
/** If the API should automatically shut down when Ordhook ingestion mode is `replay` */
5959
ORDHOOK_REPLAY_INGESTION_MODE_AUTO_SHUTDOWN: Type.Boolean({ default: true }),
60+
/**
61+
* If the API should check that streamed blocks received from Ordhook are contiguous (without
62+
* inscription number gaps).
63+
*/
64+
ORDHOOK_STREAMED_BLOCK_CONTINUITY_CHECK: Type.Boolean({ default: true }),
6065

6166
PGHOST: Type.String(),
6267
PGPORT: Type.Number({ default: 5432, minimum: 0, maximum: 65535 }),

src/pg/pg-store.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ export class PgStore extends BasePgStore {
149149
}
150150
switch (direction) {
151151
case 'apply':
152-
if (streamed) await this.assertNextBlockIsContiguous(sql, event, cache);
152+
if (streamed && ENV.ORDHOOK_STREAMED_BLOCK_CONTINUITY_CHECK)
153+
await this.assertNextBlockIsContiguous(sql, event, cache);
153154
await this.applyInscriptions(sql, cache, streamed);
154155
break;
155156
case 'rollback':

0 commit comments

Comments
 (0)