From e30cdcd0a2ed91ebe25794ebeb2b2be6cbacab76 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Tue, 18 Jun 2024 09:58:31 -0600 Subject: [PATCH] chore: gap check env --- src/env.ts | 5 +++++ src/pg/pg-store.ts | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/env.ts b/src/env.ts index bc7aca06..e4bdc157 100644 --- a/src/env.ts +++ b/src/env.ts @@ -55,6 +55,11 @@ const schema = Type.Object({ ), /** If the API should automatically shut down when Ordhook ingestion mode is `replay` */ ORDHOOK_REPLAY_INGESTION_MODE_AUTO_SHUTDOWN: Type.Boolean({ default: true }), + /** + * If the API should check that streamed blocks received from Ordhook are contiguous (without + * inscription number gaps). + */ + ORDHOOK_STREAMED_BLOCK_CONTINUITY_CHECK: Type.Boolean({ default: true }), PGHOST: Type.String(), PGPORT: Type.Number({ default: 5432, minimum: 0, maximum: 65535 }), diff --git a/src/pg/pg-store.ts b/src/pg/pg-store.ts index 3a36a1c3..76be6bf6 100644 --- a/src/pg/pg-store.ts +++ b/src/pg/pg-store.ts @@ -149,7 +149,8 @@ export class PgStore extends BasePgStore { } switch (direction) { case 'apply': - if (streamed) await this.assertNextBlockIsContiguous(sql, event, cache); + if (streamed && ENV.ORDHOOK_STREAMED_BLOCK_CONTINUITY_CHECK) + await this.assertNextBlockIsContiguous(sql, event, cache); await this.applyInscriptions(sql, cache, streamed); break; case 'rollback':