diff --git a/src/routes/txs/hash/required-signers.ts b/src/routes/txs/hash/required-signers.ts index 1b9da4ee..97fbe888 100644 --- a/src/routes/txs/hash/required-signers.ts +++ b/src/routes/txs/hash/required-signers.ts @@ -6,6 +6,7 @@ import { SQLQuery } from '../../../sql/index.js'; import * as QueryTypes from '../../../types/queries/tx.js'; import * as ResponseTypes from '../../../types/responses/tx.js'; import { getDbSync } from '../../../utils/database.js'; +import { handle404 } from '@blockfrost/blockfrost-utils/lib/fastify.js'; async function route(fastify: FastifyInstance) { fastify.route({ @@ -16,6 +17,15 @@ async function route(fastify: FastifyInstance) { const clientDbSync = await getDbSync(fastify); try { + const query404 = await clientDbSync.query(SQLQuery.get('txs_404'), [ + request.params.hash, + ]); + + if (query404.rows.length === 0) { + clientDbSync.release(); + return handle404(reply); + } + const { rows }: { rows: ResponseTypes.TxWitnesses } = await clientDbSync.query(SQLQuery.get('txs_hash_wits'), [ request.params.hash,