From 492fc510fa3abcc6693357daecd5e97f7e2d7b45 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 21 Sep 2016 22:10:19 -0400 Subject: [PATCH] move _get_my_unspent_claim to function --- lbrynet/core/LBRYWallet.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lbrynet/core/LBRYWallet.py b/lbrynet/core/LBRYWallet.py index dfc344b8d..ebbbaf373 100644 --- a/lbrynet/core/LBRYWallet.py +++ b/lbrynet/core/LBRYWallet.py @@ -376,8 +376,14 @@ class LBRYWallet(object): d.addCallback(lambda c: self._format_claim_for_return(name, c, claim['txid'])) return d + def _get_my_unspent_claim(claims): + for claim in claims: + if claim['name'] == name and not claim['is spent']: + return claim + return False + d = self.get_name_claims() - d.addCallback(lambda claims: next((c for c in claims if c['name'] == name and not c['is spent']), False)) + d.addCallback(_get_my_unspent_claim) d.addCallback(_get_claim_for_return) return d