fix database error when updating a claim that we don't have a file for (https://github.com/lbryio/lbry/issues/1165)

This commit is contained in:
Jack Robison 2018-06-14 18:14:53 -04:00
parent e83ff47722
commit c26816c92d
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 5 additions and 2 deletions

View file

@ -16,6 +16,7 @@ at anytime.
* fixed token validation error when the dht node has just been started (https://github.com/lbryio/lbry/issues/1248)
* fixed a race condition when inserting a blob into the database (https://github.com/lbryio/lbry/issues/1129)
* reflector server incorrectly responding as if it has all the blobs for a stream that was only partially uploaded to it
* `publish` raising a database error when updating a claim that we don't have a file for (https://github.com/lbryio/lbry/issues/1165)
### Deprecated
*

View file

@ -59,8 +59,10 @@ class Publisher(object):
def publish_stream(self, name, bid, claim_dict, stream_hash, claim_address=None, change_address=None):
"""Make a claim without creating a lbry file"""
claim_out = yield self.make_claim(name, bid, claim_dict, claim_address, change_address)
yield self.session.storage.save_content_claim(stream_hash, "%s:%i" % (claim_out['txid'], claim_out['nout']))
self.lbry_file = [f for f in self.lbry_file_manager.lbry_files if f.stream_hash == stream_hash][0]
if stream_hash: # the stream_hash returned from the db will be None if this isn't a stream we have
yield self.session.storage.save_content_claim(stream_hash, "%s:%i" % (claim_out['txid'],
claim_out['nout']))
self.lbry_file = [f for f in self.lbry_file_manager.lbry_files if f.stream_hash == stream_hash][0]
defer.returnValue(claim_out)
@defer.inlineCallbacks