create_and_publish_stream fix

This commit is contained in:
Lex Berezhny 2018-07-12 14:15:16 -04:00 committed by Jack Robison
parent c544e26206
commit 1d906fb0c7
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -6,6 +6,7 @@ from twisted.internet import defer
from lbrynet.core import file_utils
from lbrynet.file_manager.EncryptedFileCreator import create_lbry_file
from lbrynet.wallet.account import get_certificate_lookup
log = logging.getLogger(__name__)
@ -43,11 +44,11 @@ class Publisher(object):
claim_dict['stream']['source']['sourceType'] = 'lbry_sd_hash'
claim_dict['stream']['source']['contentType'] = get_content_type(file_path)
claim_dict['stream']['source']['version'] = "_0_0_1" # need current version here
claim_out = yield self.make_claim(name, bid, claim_dict, claim_address, change_address)
tx = yield self.make_claim(name, bid, claim_dict, claim_address, change_address)
# check if we have a file already for this claim (if this is a publish update with a new stream)
old_stream_hashes = yield self.storage.get_old_stream_hashes_for_claim_id(
claim_out['claim_id'], self.lbry_file.stream_hash
tx.get_claim_id(0), self.lbry_file.stream_hash
)
if old_stream_hashes:
for lbry_file in filter(lambda l: l.stream_hash in old_stream_hashes,
@ -56,9 +57,9 @@ class Publisher(object):
log.info("Removed old stream for claim update: %s", lbry_file.stream_hash)
yield self.storage.save_content_claim(
self.lbry_file.stream_hash, "%s:%i" % (claim_out['txid'], claim_out['nout'])
self.lbry_file.stream_hash, get_certificate_lookup(tx, 0)
)
defer.returnValue(claim_out)
defer.returnValue(tx)
@defer.inlineCallbacks
def publish_stream(self, name, bid, claim_dict, stream_hash, claim_address=None, change_address=None):