From 36bd7816fe97a69fa5cae0c3add8a4d62dad6d88 Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Mon, 18 Nov 2019 16:23:03 -0500 Subject: [PATCH] add handling for invalid claims in calculate_reposts --- lbry/lbry/wallet/server/db/writer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lbry/lbry/wallet/server/db/writer.py b/lbry/lbry/wallet/server/db/writer.py index ba99c4ff1..5e079fbc0 100644 --- a/lbry/lbry/wallet/server/db/writer.py +++ b/lbry/lbry/wallet/server/db/writer.py @@ -386,11 +386,15 @@ class SQLDB: 'support', {'txo_hash__in': [sqlite3.Binary(txo_hash) for txo_hash in txo_hashes]} )) - def calculate_reposts(self, claims: List[Output]): + def calculate_reposts(self, txos: List[Output]): targets = set() - for claim in claims: - if claim.claim.is_repost: - targets.add((claim.claim.repost.reference.claim_hash,)) + for txo in txos: + try: + claim = txo.claim + except: + continue + if claim.is_repost: + targets.add((claim.repost.reference.claim_hash,)) if targets: self.db.executemany( """