From ea6869a63ec991a28cecc4f78a867ab63fadcc45 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 27 Nov 2018 15:17:18 -0300 Subject: [PATCH] allow invalid sigs claims to show outside a channel --- lbrynet/extras/wallet/resolve.py | 7 +++---- tests/integration/wallet/test_commands.py | 6 ++++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lbrynet/extras/wallet/resolve.py b/lbrynet/extras/wallet/resolve.py index d0a5d3b3e..f996b0451 100644 --- a/lbrynet/extras/wallet/resolve.py +++ b/lbrynet/extras/wallet/resolve.py @@ -138,11 +138,10 @@ class Resolver: elif 'error' not in result: return {'error': 'claim not found', 'success': False, 'uri': str(parsed_uri)} - # invalid signatures can only return in the form of name#claim_id + # invalid signatures can only return outside a channel if result.get('claim', {}).get('has_signature', False): - if not result['claim']['signature_is_valid']: - if parsed_uri.path or parsed_uri.is_channel or not parsed_uri.claim_id or not parsed_uri.name: - return {'error': 'claim not found', 'success': False, 'uri': str(parsed_uri)} + if parsed_uri.path and not result['claim']['signature_is_valid']: + return {'error': 'claim not found', 'success': False, 'uri': str(parsed_uri)} return result async def get_certificate_and_validate_result(self, claim_result): diff --git a/tests/integration/wallet/test_commands.py b/tests/integration/wallet/test_commands.py index cf08827db..f1414c59e 100644 --- a/tests/integration/wallet/test_commands.py +++ b/tests/integration/wallet/test_commands.py @@ -623,14 +623,16 @@ class ClaimManagement(CommandTestCase): await self.confirm_tx(channel['tx']['txid']) # Original channel doesnt exists anymore, so the signature is invalid. For invalid signatures, resolution is - # only possible when using the name + claim id + # only possible outside a channel response = await self.out(self.daemon.jsonrpc_resolve(uri='lbry://@abc/on-channel-claim')) self.assertNotIn('claim', response['lbry://@abc/on-channel-claim']) response = await self.out(self.daemon.jsonrpc_resolve(uri='lbry://on-channel-claim')) - self.assertNotIn('claim', response['lbry://on-channel-claim']) + self.assertIn('claim', response['lbry://on-channel-claim']) + self.assertFalse(response['lbry://on-channel-claim']['claim']['signature_is_valid']) direct_uri = 'lbry://on-channel-claim#' + claim['claim_id'] response = await self.out(self.daemon.jsonrpc_resolve(uri=direct_uri)) self.assertIn('claim', response[direct_uri]) + self.assertFalse(response[direct_uri]['claim']['signature_is_valid']) async def test_regular_supports_and_tip_supports(self): # account2 will be used to send tips and supports to account1