From a94d87126e4bde903bdaafd9b8312414c8681b13 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 12 Apr 2023 11:45:44 -0600 Subject: [PATCH] ignore txs with invalid sPKs when scanning --- jmbitcoin/jmbitcoin/snicker.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jmbitcoin/jmbitcoin/snicker.py b/jmbitcoin/jmbitcoin/snicker.py index ec9f334..745731e 100644 --- a/jmbitcoin/jmbitcoin/snicker.py +++ b/jmbitcoin/jmbitcoin/snicker.py @@ -9,6 +9,7 @@ from jmbitcoin.secp256k1_transaction import * from collections import Counter from bitcointx.core.key import CKey, CPubKey +from bitcointx.wallet import CCoinAddressError SNICKER_MAGIC_BYTES = b'SNICKER' @@ -154,8 +155,11 @@ def is_snicker_v1_tx(tx): for vo in tx.vout: if vo.nValue == equal_out: if not matched_spk: - matched_spk = btc.CCoinAddress.from_scriptPubKey( - vo.scriptPubKey).get_scriptPubKey_type() + try: + matched_spk = btc.CCoinAddress.from_scriptPubKey( + vo.scriptPubKey).get_scriptPubKey_type() + except CCoinAddressError: + return False else: if not btc.CCoinAddress.from_scriptPubKey( vo.scriptPubKey).get_scriptPubKey_type() == matched_spk: