tcoinchooser: tweak heuristic scoring. - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit e864fa50882db90df50e6e0240f55197b28097ed DIR parent f409b5da40e607819f94093f4ca6a91f8a2b71f0 HTML Author: SomberNight <somber.night@protonmail.com> Date: Thu, 20 Jun 2019 17:47:43 +0200 coinchooser: tweak heuristic scoring. ttransactions without any change now get better scores. ttransactions with really small change get worse scores. Diffstat: M electrum/coinchooser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/coinchooser.py b/electrum/coinchooser.py t@@ -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