diff --git a/lbry/error/__init__.py b/lbry/error/__init__.py index 8827f5e17..1bc37bac4 100644 --- a/lbry/error/__init__.py +++ b/lbry/error/__init__.py @@ -215,10 +215,10 @@ class ResolveTimeoutError(WalletError): class ResolveCensoredError(WalletError): - def __init__(self, url, censor_hash): + def __init__(self, url, censor_id): self.url = url - self.censor_hash = censor_hash - super().__init__(f"Resolve of '{url}' was censored by channel with claim id '{claim_id(censor_hash)}'.") + self.censor_hash = censor_id + super().__init__(f"Resolve of '{url}' was censored by channel with claim id '{censor_id}'.") class KeyFeeAboveMaxAllowedError(WalletError): diff --git a/lbry/schema/result.py b/lbry/schema/result.py index 7b4b30009..763ba4be9 100644 --- a/lbry/schema/result.py +++ b/lbry/schema/result.py @@ -40,7 +40,7 @@ class Censor: def censor(self, row) -> bool: if self.is_censored(row): - censoring_channel_hash = row['censoring_channel_hash'] + censoring_channel_hash = bytes.fromhex(row['censoring_channel_id'])[::-1] self.censored.setdefault(censoring_channel_hash, set()) self.censored[censoring_channel_hash].add(row['tx_hash']) return True diff --git a/lbry/wallet/server/db/elasticsearch/constants.py b/lbry/wallet/server/db/elasticsearch/constants.py index 7ba84117d..33ea066f9 100644 --- a/lbry/wallet/server/db/elasticsearch/constants.py +++ b/lbry/wallet/server/db/elasticsearch/constants.py @@ -41,9 +41,9 @@ FIELDS = {'is_controlling', 'last_take_over_height', 'claim_id', 'claim_name', ' 'stream_type', 'media_type', 'fee_amount', 'fee_currency', 'duration', 'censor_type', 'claims_in_channel', 'channel_join', 'signature_valid', 'effective_amount', 'support_amount', 'trending_group', 'trending_mixed', 'trending_local', 'trending_global', 'channel_id', 'tx_id', 'tx_nout', - 'signature', 'signature_digest', 'public_key_bytes', 'public_key_id', '_id', 'tags', 'censoring_channel_id', + 'signature', 'signature_digest', 'public_key_bytes', 'public_key_id', '_id', 'tags', 'reposted_claim_id'} -TEXT_FIELDS = {'author', 'canonical_url', 'channel_id', 'claim_name', 'description', 'claim_id', +TEXT_FIELDS = {'author', 'canonical_url', 'channel_id', 'claim_name', 'description', 'claim_id', 'censoring_channel_id', 'media_type', 'normalized', 'public_key_bytes', 'public_key_id', 'short_url', 'signature', 'signature_digest', 'stream_type', 'title', 'tx_id', 'fee_currency', 'reposted_claim_id', 'tags'} RANGE_FIELDS = { diff --git a/lbry/wallet/server/db/elasticsearch/search.py b/lbry/wallet/server/db/elasticsearch/search.py index cc26c286c..0779f2aff 100644 --- a/lbry/wallet/server/db/elasticsearch/search.py +++ b/lbry/wallet/server/db/elasticsearch/search.py @@ -411,7 +411,7 @@ class SearchIndex: txo_rows = [row for row in txo_rows if isinstance(row, dict)] referenced_ids = set(filter(None, map(itemgetter('reposted_claim_id'), txo_rows))) referenced_ids |= set(filter(None, (row['channel_id'] for row in txo_rows))) - referenced_ids |= set(map(parse_claim_id, filter(None, (row['censoring_channel_id'] for row in txo_rows)))) + referenced_ids |= set(filter(None, (row['censoring_channel_id'] for row in txo_rows))) referenced_txos = [] if referenced_ids: @@ -606,8 +606,6 @@ def expand_result(results): result['channel_hash'] = unhexlify(result['channel_id'])[::-1] if result['channel_id'] else None result['txo_hash'] = unhexlify(result['tx_id'])[::-1] + struct.pack('