abandon previous claim in update
This commit is contained in:
parent
22f73a0817
commit
5abeceac1f
2 changed files with 16 additions and 7 deletions
|
@ -1911,7 +1911,13 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
metadata['fee'][currency]['address'] = address
|
metadata['fee'][currency]['address'] = address
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
|
|
||||||
d = defer.succeed(None)
|
def _delete_data(lbry_file):
|
||||||
|
txid = lbry_file.txid
|
||||||
|
d = self._delete_lbry_file(lbry_file, delete_file=False)
|
||||||
|
d.addCallback(lambda _: txid)
|
||||||
|
return d
|
||||||
|
|
||||||
|
d = self._resolve_name(name, force_refresh=True)
|
||||||
|
|
||||||
if 'fee' in p:
|
if 'fee' in p:
|
||||||
metadata['fee'] = p['fee']
|
metadata['fee'] = p['fee']
|
||||||
|
@ -1923,7 +1929,8 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
|
|
||||||
pub = Publisher(self.session, self.lbry_file_manager, self.session.wallet)
|
pub = Publisher(self.session, self.lbry_file_manager, self.session.wallet)
|
||||||
d.addCallback(lambda _: self._get_lbry_file_by_uri(name))
|
d.addCallback(lambda _: self._get_lbry_file_by_uri(name))
|
||||||
d.addCallback(lambda r: pub.start(name, file_path, bid, metadata, None if r is None else r.txid))
|
d.addCallback(lambda l: None if not l else _delete_data(l))
|
||||||
|
d.addCallback(lambda r: pub.start(name, file_path, bid, metadata, r))
|
||||||
d.addCallbacks(lambda msg: self._render_response(msg, OK_CODE),
|
d.addCallbacks(lambda msg: self._render_response(msg, OK_CODE),
|
||||||
lambda err: self._render_response(err.getTraceback(), BAD_REQUEST))
|
lambda err: self._render_response(err.getTraceback(), BAD_REQUEST))
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ class Publisher(object):
|
||||||
self.stream_hash = None
|
self.stream_hash = None
|
||||||
self.metadata = {}
|
self.metadata = {}
|
||||||
|
|
||||||
def start(self, name, file_path, bid, metadata, old_txid=None):
|
def start(self, name, file_path, bid, metadata, old_txid):
|
||||||
|
|
||||||
def _show_result():
|
def _show_result():
|
||||||
log.info("Published %s --> lbry://%s txid: %s", self.file_name, self.publish_name, self.txid)
|
log.info("Published %s --> lbry://%s txid: %s", self.file_name, self.publish_name, self.txid)
|
||||||
|
@ -111,10 +111,12 @@ class Publisher(object):
|
||||||
self.metadata['ver'] = CURRENT_METADATA_VERSION
|
self.metadata['ver'] = CURRENT_METADATA_VERSION
|
||||||
|
|
||||||
if self.old_txid:
|
if self.old_txid:
|
||||||
d = self.wallet.update_name(self.publish_name,
|
|
||||||
|
d = self.wallet.abandon_name(self.old_txid)
|
||||||
|
d.addCallback(lambda tx: log.info("Abandoned tx %s" % str(tx)))
|
||||||
|
d.addCallback(lambda _: self.wallet.claim_name(self.publish_name,
|
||||||
self.bid_amount,
|
self.bid_amount,
|
||||||
Metadata(self.metadata),
|
Metadata(self.metadata)))
|
||||||
self.old_txid)
|
|
||||||
else:
|
else:
|
||||||
d = self.wallet.claim_name(self.publish_name,
|
d = self.wallet.claim_name(self.publish_name,
|
||||||
self.bid_amount,
|
self.bid_amount,
|
||||||
|
|
Loading…
Reference in a new issue