From 677d9053de47b7c8428169b07130dd4b752510a4 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 3 Oct 2022 10:44:27 -0400 Subject: [PATCH] claim_list resolve of blocked claims --- lbry/wallet/ledger.py | 8 +++++++- tests/integration/claims/test_claim_commands.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lbry/wallet/ledger.py b/lbry/wallet/ledger.py index 42499d2c6..3df493db7 100644 --- a/lbry/wallet/ledger.py +++ b/lbry/wallet/ledger.py @@ -993,7 +993,13 @@ class Ledger(metaclass=LedgerRegistry): 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 diff --git a/tests/integration/claims/test_claim_commands.py b/tests/integration/claims/test_claim_commands.py index 1f0e15d47..9c865fd5e 100644 --- a/tests/integration/claims/test_claim_commands.py +++ b/tests/integration/claims/test_claim_commands.py @@ -1643,7 +1643,9 @@ class StreamCommands(ClaimTestCase): # 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 @@ -1656,6 +1658,10 @@ class StreamCommands(ClaimTestCase): 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]