From bc503fcd181dba94a51bfafc0aa1f402c0338e00 Mon Sep 17 00:00:00 2001 From: Steven Lee Date: Fri, 12 Apr 2024 17:07:11 -0700 Subject: [PATCH] test check --- src/indexer/index.ts | 2 +- src/indexer/updater.ts | 8 ++++++-- test/updater.test.ts | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/indexer/index.ts b/src/indexer/index.ts index 8408e9f..1133483 100644 --- a/src/indexer/index.ts +++ b/src/indexer/index.ts @@ -83,7 +83,7 @@ export class RunestoneIndexer { const newBlockhashesToIndex: string[] = []; const currentStorageBlock = await this._storage.getCurrentBlock(); - if (currentStorageBlock != null) { + if (currentStorageBlock !== null) { // If rpc block indexing is ahead of our storage, let's save up all block hashes // until we arrive back to the current storage's block tip. const bestblockhashResult = await this._rpc.getbestblockhash(); diff --git a/src/indexer/updater.ts b/src/indexer/updater.ts index f7b5c14..982ee9a 100644 --- a/src/indexer/updater.ts +++ b/src/indexer/updater.ts @@ -455,8 +455,12 @@ export class RuneUpdater implements RuneBlockIndex { continue; } - const inscructions = script.decompile(witnessStack[lastWitnessElement.length - offset]); - for (const instruction of inscructions) { + const potentiallyTapscript = witnessStack[lastWitnessElement.length - offset]; + if (potentiallyTapscript === undefined) { + continue; + } + const instructions = script.decompile(potentiallyTapscript); + for (const instruction of instructions) { if (!Buffer.isBuffer(instruction)) { continue; } diff --git a/test/updater.test.ts b/test/updater.test.ts index 5319c7e..8c3f200 100644 --- a/test/updater.test.ts +++ b/test/updater.test.ts @@ -5,7 +5,7 @@ import { BitcoinRpcClient } from '../src/rpcclient'; import { Network } from '../src/network'; import { MAGIC_EDEN_OUTPUT, getDeployRunestoneHex } from './fixtures'; import { OP_RETURN, TAPROOT_SCRIPT_PUBKEY_TYPE } from '../src/constants'; -import _ from 'lodash'; +import * as _ from 'lodash'; function getDefaultRuneUpdaterContext() { const block = {