move _get_my_unspent_claim to function

This commit is contained in:
Jack 2016-09-21 22:10:19 -04:00
parent fcfed3f441
commit 492fc510fa

View file

@ -376,8 +376,14 @@ class LBRYWallet(object):
d.addCallback(lambda c: self._format_claim_for_return(name, c, claim['txid'])) d.addCallback(lambda c: self._format_claim_for_return(name, c, claim['txid']))
return d 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 = 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) d.addCallback(_get_claim_for_return)
return d return d