diff --git a/lbry/wallet/server/leveldb.py b/lbry/wallet/server/leveldb.py index 4203ac505..01da6dd39 100644 --- a/lbry/wallet/server/leveldb.py +++ b/lbry/wallet/server/leveldb.py @@ -565,7 +565,7 @@ class LevelDB: reposted_has_source = False if not reposted_metadata.is_stream else reposted_metadata.stream.has_source reposted_claim_type = CLAIM_TYPES[reposted_metadata.claim_type] reposted_stream_type = STREAM_TYPES[guess_stream_type(reposted_metadata.stream.source.media_type)] \ - if reposted_metadata.is_stream else 0 + if reposted_has_source else 0 reposted_media_type = reposted_metadata.stream.source.media_type if reposted_metadata.is_stream else 0 if not reposted_metadata.is_stream or not reposted_metadata.stream.has_fee: reposted_fee_amount = 0 @@ -626,7 +626,8 @@ class LevelDB: 'has_source': reposted_has_source if metadata.is_repost else ( False if not metadata.is_stream else metadata.stream.has_source), 'stream_type': STREAM_TYPES[guess_stream_type(metadata.stream.source.media_type)] - if metadata.is_stream else reposted_stream_type if metadata.is_repost else 0, + if metadata.is_stream and metadata.stream.has_source + else reposted_stream_type if metadata.is_repost else 0, 'media_type': metadata.stream.source.media_type if metadata.is_stream else reposted_media_type if metadata.is_repost else None, 'fee_amount': fee_amount if not metadata.is_repost else reposted_fee_amount, diff --git a/tests/integration/claims/test_claim_commands.py b/tests/integration/claims/test_claim_commands.py index 025af4355..6bcd27d1d 100644 --- a/tests/integration/claims/test_claim_commands.py +++ b/tests/integration/claims/test_claim_commands.py @@ -12,6 +12,7 @@ from lbry.error import InsufficientFundsError from lbry.extras.daemon.daemon import DEFAULT_PAGE_SIZE from lbry.testcase import CommandTestCase from lbry.wallet.orchstr8.node import SPVNode +from lbry.wallet.server.db.common import STREAM_TYPES from lbry.wallet.transaction import Transaction, Output from lbry.wallet.util import satoshis_to_coins as lbc from lbry.crypto.hash import sha256 @@ -227,6 +228,7 @@ class ClaimSearchCommand(ClaimTestCase): await self.assertListsClaims([channel_repost, no_source_repost, normal_repost, normal], has_source=True) await self.assertFindsClaims([channel_repost, no_source_repost, normal_repost, normal, no_source, channel]) await self.assertListsClaims([channel_repost, no_source_repost, normal_repost, normal, no_source, channel]) + await self.assertFindsClaims([normal_repost, normal], stream_types=list(STREAM_TYPES.keys())) async def test_pagination(self): await self.create_channel()