Merge pull request #1669 from lbryio/fix_invalid_sigs_from_name

allow invalid sigs claims to show outside a channel
This commit is contained in:
Jack Robison 2018-11-27 14:41:28 -05:00 committed by GitHub
commit bae2676b69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -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):

View file

@ -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