only save the content claim if stream_hash isn't None

-stream_hash being none means we don't have the file in the database
This commit is contained in:
Jack Robison 2019-05-10 11:24:04 -04:00
parent 6c0c0ee322
commit 324cbdcdb2
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 6 additions and 1 deletions

View file

@ -2503,7 +2503,8 @@ 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)
)]) )])
await self.storage.save_content_claim(stream_hash, new_txo.id) if stream_hash:
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:
await account.ledger.release_tx(tx) await account.ledger.release_tx(tx)

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())