From 3cde20ead47bf2fc895ea37789b824098b984f7a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 7 Feb 2026 13:22:56 -0800 Subject: skip decoding outputs without addresses --- lib/zmq.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/zmq.ts b/lib/zmq.ts index d3c8aed3..b743a750 100644 --- a/lib/zmq.ts +++ b/lib/zmq.ts @@ -81,16 +81,21 @@ const decodeTx = (raw: Uint8Array, confirmed: boolean) => { const vout = []; for (let i = 0; i < tx.outputsLength; i++) { const { amount } = tx.getOutput(i); - vout.push({ - scriptpubkey_address: tx.getOutputAddress(i, btcNetwork), - value: Number(amount), - }); + let scriptpubkey_address: string | undefined; + try { + scriptpubkey_address = tx.getOutputAddress(i, btcNetwork); + } catch {} + if (scriptpubkey_address) { + vout.push({ scriptpubkey_address, value: Number(amount) }); + } } return { txid: tx.id, vout, status: { confirmed } }; }; const handleRawTx = async (raw: Uint8Array) => { - await processWatchedTx(decodeTx(raw, false)); + try { + await processWatchedTx(decodeTx(raw, false)); + } catch {} }; const handleRawBlock = async (raw: Uint8Array) => { -- cgit v1.2.3