Merge pull request #256 from kaykurokawa/fix_get_my_claim

Update right after making claim will fail due to get_my_claim()
This commit is contained in:
Jack Robison 2016-11-14 13:37:54 -05:00 committed by GitHub
commit 763fefb33f

View file

@ -370,22 +370,15 @@ class Wallet(object):
return d
def get_my_claim(self, name):
def _convert_units(claim):
amount = Decimal(claim['nEffectiveAmount'] / COIN)
claim['nEffectiveAmount'] = amount
return claim
def _get_claim_for_return(claim):
if not claim:
return False
d = self.get_claim(name, claim['claim_id'])
d.addCallback(_convert_units)
d.addCallback(lambda clm: self._format_claim_for_return(name, clm, claim['txid']))
return d
claim['value'] = json.loads(claim['value'])
return claim
def _get_my_unspent_claim(claims):
for claim in claims:
if claim['name'] == name and not claim['is spent'] and not claim.get('supported_claimid'):
if claim['name'] == name and not claim['is spent'] and not claim.get('supported_claimid',False):
return claim
return False