Commit a4174002 authored by Pascal Engélibert's avatar Pascal Engélibert

Mono-amount mix

parent 6b952b05
peers
default.ini
__pycache__/
......@@ -614,19 +614,29 @@ class ClientThread(Thread):
if ok:
ready_txs.append(tx)
if len(ready_txs) >= self.conf["mix"]["mix_min_txs"]:
random.shuffle(ready_txs)
for tx in ready_txs:
try:
sendTransaction(self.keys, tx.receiver_pubkey, tx.out_amount, gen_comment(tx.out_seeds))
tx.tx_sent = True
tx.export_ubjson(self.db_txs)
except socket.timeout:
logPrint("Error when sending tx: timeout", LOG_ERROR)
except Exception as e:
logPrint("Error when sending tx: " + str(e), LOG_ERROR)
else:
logPrint("Not enough ready txs to mix (only "+str(len(ready_txs))+")", LOG_TRACE)
# Group txs by amount
ready_txs_by_amount = {}
for tx in ready_txs:
if not tx.in_amount in ready_txs_by_amount:
ready_txs_by_amount[tx.in_amount] = []
ready_txs_by_amount[tx.in_amount].append(tx)
# Check and send txs
for amount in ready_txs_by_amount:
txs = ready_txs_by_amount[amount]
if len(txs) >= self.conf["mix"]["mix_min_txs"]:
random.shuffle(txs)
for tx in txs:
try:
sendTransaction(self.keys, tx.receiver_pubkey, tx.out_amount, gen_comment(tx.out_seeds))
tx.tx_sent = True
tx.export_ubjson(self.db_txs)
except socket.timeout:
logPrint("Error when sending tx: timeout", LOG_ERROR)
except Exception as e:
logPrint("Error when sending tx: " + str(e), LOG_ERROR)
else:
logPrint("Not enough ready txs to mix ("+str(amount)+"u) (only "+str(len(txs))+")", LOG_TRACE)
logPrint("Mix finished", LOG_TRACE)
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment