dont error when claim search gets invalid channel

This commit is contained in:
Lex Berezhny 2019-06-22 21:41:20 -04:00
parent a8b590ecbb
commit 9e11fc1e99
2 changed files with 2 additions and 1 deletions

View file

@ -791,7 +791,7 @@ class SQLDB:
if isinstance(match, sqlite3.Row):
constraints['channel_hash'] = match['claim_hash']
else:
raise LookupError(f'Could not resolve channel "{channel_url}".')
return [[0]] if cols == 'count(*)' else []
if 'channel_hash' in constraints:
constraints['claim.channel_hash'] = sqlite3.Binary(constraints.pop('channel_hash'))
if 'channel_ids' in constraints:

View file

@ -139,6 +139,7 @@ class ClaimSearchCommand(ClaimTestCase):
await self.assertFindsClaims(claims, channel=f"@abc#{self.channel_id}")
await self.assertFindsClaims([three, two, signed2, signed], channel_ids=[channel_id2, self.channel_id])
await self.channel_abandon(claim_id=self.channel_id)
await self.assertFindsClaims([], channel=f"@abc#{self.channel_id}", valid_channel_signatures=True)
await self.assertFindsClaims([], channel_ids=[self.channel_id], valid_channel_signatures=True)
await self.assertFindsClaims([signed2], channel_ids=[channel_id2], valid_channel_signatures=True)
# pass `invalid_channel_signatures=False` to catch a bug in argument processing