Merge pull request #161 from lbryio/delete-lbry-file-without-claim

Delete lbry file with abandoned claim
This commit is contained in:
Jack Robison 2016-09-14 22:41:43 -04:00 committed by GitHub
commit c8bb0c0bc8
7 changed files with 38 additions and 11 deletions

View file

@ -70,7 +70,7 @@ class DownloadManager(object):
def add_blob_to_list(blob, blob_num):
self.blobs[blob_num] = blob
log.info("Added blob (hash: %s, number %s) to the list", str(blob.blob_hash), str(blob_num))
log.debug("Added blob (hash: %s, number %s) to the list", str(blob.blob_hash), str(blob_num))
def error_during_add(err):
log.warning("An error occurred adding the blob to blobs. Error:%s", err.getErrorMessage())

View file

@ -86,6 +86,12 @@ def disable_noisy_loggers():
logging.getLogger('lbrynet.core.server.BlobAvailabilityHandler').setLevel(logging.INFO)
logging.getLogger('lbrynet.dht').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbrynet_daemon.LBRYExchangeRateManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbrynet_daemon.LBRYDaemon').setLevel(logging.INFO)
logging.getLogger('lbrynet.core.LBRYWallet').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbryfile.LBRYFileMetadataManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.core.client.DownloadManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.lbryfilemanager.LBRYFileManager').setLevel(logging.INFO)
logging.getLogger('lbrynet.core.server.BlobRequestHandler').setLevel(logging.INFO)
@_log_decorator

View file

@ -78,11 +78,11 @@ class BlobRequestHandler(object):
if read_handle is not None:
self.currently_uploading = blob
self.read_handle = read_handle
log.debug("Sending %s to client", str(blob))
log.info("Sending %s to client", str(blob))
response_fields['blob_hash'] = blob.blob_hash
response_fields['length'] = blob.length
return response
log.debug("We can not send %s", str(blob))
log.warning("We can not send %s", str(blob))
response_fields['error'] = "BLOB_UNAVAILABLE"
return response
@ -132,13 +132,13 @@ class BlobRequestHandler(object):
def start_transfer():
self.file_sender = FileSender()
log.info("Starting the file upload")
log.debug("Starting the file upload")
assert self.read_handle is not None, "self.read_handle was None when trying to start the transfer"
d = self.file_sender.beginFileTransfer(self.read_handle, consumer, count_bytes)
return d
def set_expected_payment():
log.info("Setting expected payment")
log.debug("Setting expected payment")
if self.blob_bytes_uploaded != 0 and self.blob_data_payment_rate is not None:
# TODO: explain why 2**20
self.wallet.add_expected_payment(self.peer,

View file

@ -236,7 +236,7 @@ class DBLBRYFileMetadataManager(object):
@rerun_if_locked
def _get_sd_blob_hashes_for_stream(self, stream_hash):
log.info("Looking up sd blob hashes for stream hash %s", str(stream_hash))
log.debug("Looking up sd blob hashes for stream hash %s", str(stream_hash))
d = self.db_conn.runQuery("select sd_blob_hash from lbry_file_descriptors where stream_hash = ?",
(stream_hash,))
d.addCallback(lambda results: [r[0] for r in results])

View file

@ -10,6 +10,9 @@ from lbrynet.lbryfilemanager.LBRYFileStatusReport import LBRYFileStatusReport
from lbrynet.interfaces import IStreamDownloaderFactory
from lbrynet.lbryfile.StreamDescriptor import save_sd_info
from twisted.internet import defer
import logging
log = logging.getLogger(__name__)
class ManagedLBRYFileDownloader(LBRYFileSaver):
@ -48,11 +51,16 @@ class ManagedLBRYFileDownloader(LBRYFileSaver):
self.claim_id = claim_id
return defer.succeed(None)
def _notify_bad_claim(name, txid):
log.error("Error loading name claim for lbry file: lbry://%s, tx %s does not contain a valid claim", name, txid)
log.warning("lbry file for lbry://%s, tx %s has no claim, deleting it", name, txid)
return self.lbry_file_manager.delete_lbry_file(self)
def _save_claim(name, txid):
self.uri = name
self.txid = txid
d = self.wallet.get_claimid(name, txid)
d.addCallback(_save_claim_id)
d.addCallbacks(_save_claim_id, lambda err: _notify_bad_claim(name, txid))
return d
d.addCallback(_save_sd_hash)

View file

@ -82,9 +82,9 @@ class LBRYFileManager(object):
def log_error(err, rowid, stream_hash, options):
log.error("An error occurred while starting a lbry file: %s", err.getErrorMessage())
log.error(rowid)
log.error(stream_hash)
log.error(options)
log.debug(rowid)
log.debug(stream_hash)
log.debug(options)
def start_lbry_files(lbry_files_and_options):
for rowid, stream_hash, options in lbry_files_and_options:

View file

@ -2032,7 +2032,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
Args:
'txid': txid of claim, string
Return:
Confirmation message
txid
"""
if 'txid' in p.keys():
@ -2051,6 +2051,19 @@ class LBRYDaemon(jsonrpc.JSONRPC):
return d
def jsonrpc_abandon_name(self, p):
"""
DEPRECIATED, use abandon_claim
Args:
'txid': txid of claim, string
Return:
txid
"""
return self.jsonrpc_abandon_claim(p)
def jsonrpc_support_claim(self, p):
"""
Support a name claim