Bypass potential loss checking code if potential loss is 0

This commit is contained in:
moneromooo 2015-01-20 19:52:10 +00:00
parent 689469f298
commit 590b9ef9c5

View file

@ -29,16 +29,17 @@ def IsBetAmountValid(amount,minbet,maxbet,potential_loss,max_loss,max_loss_ratio
return False, "Max bet is %s" % AmountToString(maxbet * coinspecs.atomic_units) return False, "Max bet is %s" % AmountToString(maxbet * coinspecs.atomic_units)
if amount < minbet: if amount < minbet:
return False, "Min bet is %s" % AmountToString(minbet * coinspecs.atomic_units) return False, "Min bet is %s" % AmountToString(minbet * coinspecs.atomic_units)
if potential_loss > max_loss: if potential_loss > 0:
return False, "Max potential loss is %s" % AmountToString(max_loss * coinspecs.atomic_units) if potential_loss > max_loss:
try: return False, "Max potential loss is %s" % AmountToString(max_loss * coinspecs.atomic_units)
house_balance = RetrieveHouseBalance() try:
except Exception,e: house_balance = RetrieveHouseBalance()
log_error('Failed to get house balance: %s' % str(e)) except Exception,e:
return False, "Failed to get house balance" log_error('Failed to get house balance: %s' % str(e))
max_floating_loss = max_loss_ratio * house_balance / coinspecs.atomic_units return False, "Failed to get house balance"
if potential_loss > max_floating_loss: max_floating_loss = max_loss_ratio * house_balance / coinspecs.atomic_units
return False, "Potential loss too large for house balance" if potential_loss > max_floating_loss:
return False, "Potential loss too large for house balance"
return True, None return True, None