From 9531bdf396fb4f186ea06b52e24853a1a0473735 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Sun, 9 Apr 2017 21:44:08 -0400 Subject: [PATCH] fix file_list for files with abandoned claims --- CHANGELOG.md | 2 +- lbrynet/core/Wallet.py | 3 +++ lbrynet/lbrynet_daemon/Daemon.py | 16 ++++++---------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 337f7d6b1..b18a52a64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ at anytime. ### Fixed * `file_list` for files with bad signatures * return None from resolve commands when nothing is found - * + * return lbry files with claims that are abandoned ## [0.9.2rc9] - 2017-04-08 ### Added diff --git a/lbrynet/core/Wallet.py b/lbrynet/core/Wallet.py index 1126ef752..e8156bdc8 100644 --- a/lbrynet/core/Wallet.py +++ b/lbrynet/core/Wallet.py @@ -454,6 +454,9 @@ class Wallet(object): @defer.inlineCallbacks def get_claim(self, claim_id): claim = yield self._get_claim_by_claimid(claim_id) + if not claim: + log.warning("Claim does not exist: %s", claim_id) + defer.returnValue(None) try: decoded = smart_decode(claim['value']) claim['value'] = decoded.claim_dict diff --git a/lbrynet/lbrynet_daemon/Daemon.py b/lbrynet/lbrynet_daemon/Daemon.py index 0c5844eae..17da00317 100644 --- a/lbrynet/lbrynet_daemon/Daemon.py +++ b/lbrynet/lbrynet_daemon/Daemon.py @@ -909,19 +909,15 @@ class Daemon(AuthJSONRPCServer): size = None message = None - if lbry_file.claim_id: - claim = yield self.session.wallet.get_claim(lbry_file.claim_id) - else: - claim = yield self.session.wallet.get_claim_info(lbry_file.name, - lbry_file.txid, - lbry_file.nout) - try: + claim = yield self.session.wallet.get_claim(lbry_file.claim_id) + + if claim and 'value' in claim: metadata = claim['value'] - except: + else: metadata = None - try: + if lbry_file.txid and lbry_file.nout is not None: outpoint = repr(ClaimOutpoint(lbry_file.txid, lbry_file.nout)) - except TypeError: + else: outpoint = None if claim and 'has_signature' in claim: