forked from LBRYCommunity/lbry-sdk
fix claim id handling during publish from the latest changes
This commit is contained in:
parent
f589410496
commit
75f57fc517
3 changed files with 9 additions and 8 deletions
|
@ -381,14 +381,14 @@ class Daemon(AuthJSONRPCServer):
|
||||||
self.analytics_manager.send_claim_action('publish')
|
self.analytics_manager.send_claim_action('publish')
|
||||||
nout = 0
|
nout = 0
|
||||||
script = tx.outputs[nout].script
|
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({
|
defer.returnValue({
|
||||||
"success": True,
|
"success": True,
|
||||||
"txid": tx.hex_id.decode(),
|
"txid": tx.id,
|
||||||
"nout": nout,
|
"nout": nout,
|
||||||
"tx": hexlify(tx.raw),
|
"tx": hexlify(tx.raw),
|
||||||
"fee": str(Decimal(tx.fee) / COIN),
|
"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']),
|
"value": hexlify(script.values['claim']),
|
||||||
"claim_address": self.ledger.hash160_to_address(script.values['pubkey_hash'])
|
"claim_address": self.ledger.hash160_to_address(script.values['pubkey_hash'])
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
|
from binascii import hexlify
|
||||||
|
|
||||||
from twisted.internet import defer
|
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)
|
# 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(
|
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:
|
if old_stream_hashes:
|
||||||
for lbry_file in filter(lambda l: l.stream_hash in 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)
|
log.info("Removed old stream for claim update: %s", lbry_file.stream_hash)
|
||||||
|
|
||||||
yield self.storage.save_content_claim(
|
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)
|
defer.returnValue(tx)
|
||||||
|
|
||||||
|
|
|
@ -176,12 +176,12 @@ class LbryWalletManager(BaseWalletManager):
|
||||||
if isinstance(address, buffer):
|
if isinstance(address, buffer):
|
||||||
address = str(address)
|
address = str(address)
|
||||||
return {
|
return {
|
||||||
"claim_id": hexlify(tx.get_claim_id(txo.index)).decode(),
|
"claim_id": hexlify(tx.get_claim_id(txo.position)).decode(),
|
||||||
"name": name,
|
"name": name,
|
||||||
"amount": bid,
|
"amount": bid,
|
||||||
"address": address.decode(),
|
"address": address.decode(),
|
||||||
"txid": tx.hex_id.decode(),
|
"txid": tx.id.decode(),
|
||||||
"nout": txo.index,
|
"nout": txo.position,
|
||||||
"value": claim_dict,
|
"value": claim_dict,
|
||||||
"height": -1,
|
"height": -1,
|
||||||
"claim_sequence": -1,
|
"claim_sequence": -1,
|
||||||
|
|
Loading…
Reference in a new issue