fix claim id handling during publish from the latest changes

This commit is contained in:
Victor Shyba 2018-07-15 19:09:35 -03:00 committed by Jack Robison
parent f589410496
commit 75f57fc517
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 9 additions and 8 deletions

View file

@ -381,14 +381,14 @@ class Daemon(AuthJSONRPCServer):
self.analytics_manager.send_claim_action('publish')
nout = 0
script = tx.outputs[nout].script
log.info("Success! Published to lbry://%s txid: %s nout: %d", name, tx.hex_id.decode(), nout)
log.info("Success! Published to lbry://%s txid: %s nout: %d", name, tx.id, nout)
defer.returnValue({
"success": True,
"txid": tx.hex_id.decode(),
"txid": tx.id,
"nout": nout,
"tx": hexlify(tx.raw),
"fee": str(Decimal(tx.fee) / COIN),
"claim_id": hexlify(tx.get_claim_id(0)),
"claim_id": hexlify(tx.get_claim_id(0)[::-1]),
"value": hexlify(script.values['claim']),
"claim_address": self.ledger.hash160_to_address(script.values['pubkey_hash'])
})

View file

@ -1,6 +1,7 @@
import logging
import mimetypes
import os
from binascii import hexlify
from twisted.internet import defer
@ -49,7 +50,7 @@ class Publisher(object):
# 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(
tx.get_claim_id(0), self.lbry_file.stream_hash.decode()
hexlify(tx.get_claim_id(0)[::-1]), self.lbry_file.stream_hash
)
if old_stream_hashes:
for lbry_file in filter(lambda l: l.stream_hash in old_stream_hashes,
@ -58,7 +59,7 @@ 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.decode(), get_certificate_lookup(tx, 0)
self.lbry_file.stream_hash, get_certificate_lookup(tx, 0)
)
defer.returnValue(tx)

View file

@ -176,12 +176,12 @@ class LbryWalletManager(BaseWalletManager):
if isinstance(address, buffer):
address = str(address)
return {
"claim_id": hexlify(tx.get_claim_id(txo.index)).decode(),
"claim_id": hexlify(tx.get_claim_id(txo.position)).decode(),
"name": name,
"amount": bid,
"address": address.decode(),
"txid": tx.hex_id.decode(),
"nout": txo.index,
"txid": tx.id.decode(),
"nout": txo.position,
"value": claim_dict,
"height": -1,
"claim_sequence": -1,