Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

claim_list shows metadata of blocked claims #3677

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lbry/wallet/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,13 @@ async def _resolve_for_local_claim_results(self, accounts, txos):
results.append(resolved)
else:
if isinstance(resolved, dict) and 'error' in resolved:
txo.meta['error'] = resolved['error']
if resolved['error'].get('name') == 'BLOCKED' and txo.is_claim and txo.claim.is_repost:
txo.meta['blocked_repost'] = await self.get_claim_by_claim_id(
txo.claim.repost.reference.claim_id,
accounts=accounts
)
else:
txo.meta['error'] = resolved['error']
results.append(txo)
return results

Expand Down
8 changes: 7 additions & 1 deletion tests/integration/claims/test_claim_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,9 @@ async def test_filtering_channels_for_removing_content(self):

# block channel
self.assertEqual(0, len(self.conductor.spv_node.server.db.blocked_channels))
await self.stream_repost(bad_channel_id, 'block2', '0.1', channel_name='@blocking')
blocked_repost_id = self.get_claim_id(
await self.stream_repost(bad_channel_id, 'block2', '0.1', channel_name='@blocking')
)
self.assertEqual(1, len(self.conductor.spv_node.server.db.blocked_channels))

# channel, claim in channel or claim individually no longer resolve
Expand All @@ -1656,6 +1658,10 @@ async def test_filtering_channels_for_removing_content(self):
self.assertEqual((await self.resolve('lbry://worse_content'))['error']['name'], 'BLOCKED')
self.assertEqual((await self.resolve('lbry://@bad_channel/worse_content'))['error']['name'], 'BLOCKED')

# blocked claim should still show in local claim list
claims = await self.claim_list(claim_id=blocked_repost_id, resolve=True)
self.assertIn('blocked_repost', claims[0]['meta'])

async def test_publish_updates_file_list(self):
tx = await self.stream_create(title='created')
txo = tx['outputs'][0]
Expand Down