1
0

coinchooser: tweak heuristic scoring.

transactions without any change now get better scores.
transactions with really small change get worse scores.
This commit is contained in:
SomberNight
2019-06-20 17:47:43 +02:00
parent f409b5da40
commit e864fa5088

View File

@@ -413,8 +413,13 @@ class CoinChooserPrivacy(CoinChooserRandom):
tx, change_outputs = tx_from_buckets(buckets)
change = sum(o.value for o in change_outputs)
# Penalize change not roughly in output range
if change < min_change:
if change == 0:
pass # no change is great!
elif change < min_change:
badness += (min_change - change) / (min_change + 10000)
# Penalize really small change; under 1 mBTC ~= using 1 more input
if change < COIN / 1000:
badness += 1
elif change > max_change:
badness += (change - max_change) / (max_change + 10000)
# Penalize large change; 5 BTC excess ~= using 1 more input