From 3c5fb6490d68c305b9139243be80f6242bb88012 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Thu, 18 Oct 2018 13:00:27 -0400 Subject: [PATCH] catch errors --- lbrynet/core/HTTPBlobDownloader.py | 6 ++++-- lbrynet/wallet/account.py | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lbrynet/core/HTTPBlobDownloader.py b/lbrynet/core/HTTPBlobDownloader.py index 64bc67494..8bf6292fe 100644 --- a/lbrynet/core/HTTPBlobDownloader.py +++ b/lbrynet/core/HTTPBlobDownloader.py @@ -2,6 +2,7 @@ from random import choice import logging from twisted.internet import defer, task from twisted.internet.error import ConnectingCancelledError +from twisted.web._newclient import ResponseNeverReceived import treq from lbrynet.core.utils import DeferredDict from lbrynet.core.Error import DownloadCanceledError @@ -132,9 +133,10 @@ class HTTPBlobDownloader: yield self.blob_manager.blob_completed(blob, should_announce=should_announce) self.downloaded_blob_hashes.append(blob.blob_hash) break - except (IOError, Exception, defer.CancelledError, ConnectingCancelledError) as e: + except (IOError, Exception, defer.CancelledError, ConnectingCancelledError, ResponseNeverReceived) as e: if isinstance( - e, (DownloadCanceledError, defer.CancelledError, ConnectingCancelledError) + e, (DownloadCanceledError, defer.CancelledError, ConnectingCancelledError, + ResponseNeverReceived) ) or 'closed file' in str(e): # some other downloader finished first or it was simply cancelled log.info("Mirror download cancelled: %s", blob.blob_hash) diff --git a/lbrynet/wallet/account.py b/lbrynet/wallet/account.py index edf3f2637..97988955e 100644 --- a/lbrynet/wallet/account.py +++ b/lbrynet/wallet/account.py @@ -94,6 +94,10 @@ class Account(BaseAccount): try: txid, nout = maybe_claim_id.split(':') tx = await self.ledger.db.get_transaction(txid=txid) + if not tx: + log.warning("Claim migration failed to find a transaction for outpoint %s:%i") + results['previous-corrupted'] += 1 + continue if tx.outputs[int(nout)].script.is_claim_involved: results['previous-success'] += 1 else: