handle unicode error for unnormalized names

This commit is contained in:
Jack Robison 2021-08-15 16:24:07 -04:00 committed by Victor Shyba
parent e212ce23e3
commit 7e78fdec04

View file

@ -411,7 +411,10 @@ class BlockProcessor:
def _add_claim_or_update(self, height: int, txo: 'Output', tx_hash: bytes, tx_num: int, nout: int, def _add_claim_or_update(self, height: int, txo: 'Output', tx_hash: bytes, tx_num: int, nout: int,
spent_claims: typing.Dict[bytes, typing.Tuple[int, int, str]]): spent_claims: typing.Dict[bytes, typing.Tuple[int, int, str]]):
claim_name = txo.script.values['claim_name'].decode() try:
claim_name = txo.script.values['claim_name'].decode()
except UnicodeDecodeError:
claim_name = ''.join(chr(c) for c in txo.script.values['claim_name'])
try: try:
normalized_name = txo.normalized_name normalized_name = txo.normalized_name
except UnicodeDecodeError: except UnicodeDecodeError: