fix publish updates not being saved to the db, don't query the db for the stream hash

This commit is contained in:
Jack Robison 2019-04-12 13:31:26 -04:00
parent 1a14157d37
commit 1375153fda
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -2277,9 +2277,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, claim, name, dewies_to_lbc(amount) tx, new_txo, claim_address, claim, name, dewies_to_lbc(amount)
)]) )])
stream_hash = await self.storage.get_stream_hash_for_sd_hash(claim.stream.source.sd_hash) await self.storage.save_content_claim(file_stream.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)
@ -2432,6 +2430,9 @@ class Daemon(metaclass=JSONRPCServerType):
file_stream = await self.stream_manager.create_stream(file_path) file_stream = await self.stream_manager.create_stream(file_path)
new_txo.claim.stream.source.sd_hash = file_stream.sd_hash new_txo.claim.stream.source.sd_hash = file_stream.sd_hash
new_txo.script.generate() new_txo.script.generate()
stream_hash = file_stream.stream_hash
else:
stream_hash = await self.storage.get_stream_hash_for_sd_hash(old_txo.claim.stream.source.sd_hash)
if channel: if channel:
new_txo.sign(channel) new_txo.sign(channel)
await tx.sign([account]) await tx.sign([account])
@ -2439,8 +2440,6 @@ 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)
)]) )])
stream_hash = await self.storage.get_stream_hash_for_sd_hash(new_txo.claim.stream.source.sd_hash)
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: