diff --git a/.sourcery.yaml b/.sourcery.yaml index aa5b73c7..ab9a4e7d 100644 --- a/.sourcery.yaml +++ b/.sourcery.yaml @@ -1,14 +1,14 @@ ignore: - - .git - - venv - - .venv - - env - - .env - - .tox - - node_modules - - vendor - - worker-configuration.d.ts - - *.tmp.* + - .git + - venv + - .venv + - env + - .env + - .tox + - node_modules + - vendor + - worker-configuration.d.ts + - "*.tmp.*" rule_settings: enable: [default] diff --git a/packages/btcindexer/src/btcindexer.ts b/packages/btcindexer/src/btcindexer.ts index 1f5b13a6..eb000a21 100644 --- a/packages/btcindexer/src/btcindexer.ts +++ b/packages/btcindexer/src/btcindexer.ts @@ -284,10 +284,16 @@ export class Indexer implements Storage { for (const [txId, txGroup] of groupedTxs.entries()) { try { - const rawBlockHex = await this.blocksDB.get(txGroup.block_hash); - if (!rawBlockHex) continue; - - const block = Block.fromHex(rawBlockHex); + const rawBlockBuffer = await this.blocksDB.get(txGroup.block_hash, { + type: "arrayBuffer", + }); + if (!rawBlockBuffer) { + console.warn( + `Block data not found in KV for hash: ${txGroup.block_hash}. Skipping TX ${txId}.`, + ); + continue; + } + const block = Block.fromBuffer(Buffer.from(rawBlockBuffer)); const merkleTree = this.constructMerkleTree(block); if (!merkleTree) continue;