Merge pull request #2107 from lbryio/fix-update-file-we-dont-have

fix stream_update failing on metadata only updates for files we don't have
This commit is contained in:
Jack Robison 2019-05-10 12:28:53 -04:00 committed by GitHub
commit 7d2f592bb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View file

@ -2503,6 +2503,7 @@ class Daemon(metaclass=JSONRPCServerType):
await self.storage.save_claims([self._old_get_temp_claim_info( await self.storage.save_claims([self._old_get_temp_claim_info(
tx, new_txo, claim_address, new_txo.claim, new_txo.claim_name, dewies_to_lbc(amount) tx, new_txo, claim_address, new_txo.claim, new_txo.claim_name, dewies_to_lbc(amount)
)]) )])
if stream_hash:
await self.storage.save_content_claim(stream_hash, new_txo.id) await self.storage.save_content_claim(stream_hash, new_txo.id)
await self.analytics_manager.send_claim_action('publish') await self.analytics_manager.send_claim_action('publish')
else: else:

View file

@ -545,8 +545,8 @@ class SQLiteStorage(SQLiteMixin):
"select stream_hash, download_directory, file_name from file where saved_file=1" "select stream_hash, download_directory, file_name from file where saved_file=1"
).fetchall(): ).fetchall():
if download_directory and file_name and os.path.isfile( if download_directory and file_name and os.path.isfile(
os.path.join(binascii.unhexlify(download_directory.encode()).decode(), os.path.join(binascii.unhexlify(download_directory).decode(),
binascii.unhexlify(file_name.encode()).decode())): binascii.unhexlify(file_name).decode())):
continue continue
else: else:
removed.append((stream_hash,)) removed.append((stream_hash,))

View file

@ -586,6 +586,10 @@ class StreamCommands(CommandTestCase):
self.assertEqual(txs[0]['value'], '0.0') self.assertEqual(txs[0]['value'], '0.0')
self.assertEqual(txs[0]['fee'], '-0.020107') self.assertEqual(txs[0]['fee'], '-0.020107')
await self.assertBalance(self.account, '7.479893') await self.assertBalance(self.account, '7.479893')
self.assertEqual(1, len(self.daemon.jsonrpc_file_list()))
await self.daemon.jsonrpc_file_delete(delete_all=True)
self.assertEqual(0, len(self.daemon.jsonrpc_file_list()))
await self.stream_update(claim_id, bid='1.0') # updates previous claim await self.stream_update(claim_id, bid='1.0') # updates previous claim
txs = await self.out(self.daemon.jsonrpc_transaction_list()) txs = await self.out(self.daemon.jsonrpc_transaction_list())