Skip to content

Commit

Permalink
Namecoin: properly handle malformed script in get_name_op_from_output…
Browse files Browse the repository at this point in the history
…_script
  • Loading branch information
JeremyRand committed Oct 1, 2018
1 parent f5332b6 commit fef9da4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions electrum_nmc/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def split_name_script(decoded):
return {"name_op": None, "address_scriptPubKey": decoded}

def get_name_op_from_output_script(_bytes):
decoded = [x for x in script_GetOp(_bytes)]
try:
decoded = [x for x in script_GetOp(_bytes)]
except MalformedBitcoinScript:
decoded = None

# Extract the name script if one is present.
return split_name_script(decoded)["name_op"]
Expand Down Expand Up @@ -254,7 +257,7 @@ def get_wallet_name_delta(wallet, tx):
import re

from .bitcoin import push_script, script_to_scripthash
from .transaction import match_decoded, opcodes, script_GetOp
from .transaction import MalformedBitcoinScript, match_decoded, opcodes, script_GetOp
from .util import bh2u

OP_NAME_NEW = opcodes.OP_1
Expand Down

0 comments on commit fef9da4

Please sign in to comment.