bookie: ensure a winner player never gets less than his/her bet

This could conceivably happen in a game where one side bets a lot
more than the other side.
master
moneromooo 10 years ago
parent e2787cc2b3
commit 00b742445e

@ -390,6 +390,8 @@ def Result(link,cmd):
ounits = long(redis_hget(tname,bettor+":units"))
if o == outcome:
owinunits = long(total_units_bet * (1-config.bookie_fee) * ounits / total_units_bet_by_winners)
if owinunits<ounits:
owinunits=units
resultmsg.append("%s wins %s" % (NickFromIdentity(bettor), AmountToString(owinunits)))
p.hincrby("balances",bettor,owinunits)
else:

Loading…
Cancel
Save