electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit e864fa50882db90df50e6e0240f55197b28097ed
parent f409b5da40e607819f94093f4ca6a91f8a2b71f0
Author: SomberNight <somber.night@protonmail.com>
Date:   Thu, 20 Jun 2019 17:47:43 +0200

coinchooser: tweak heuristic scoring.

transactions without any change now get better scores.
transactions with really small change get worse scores.

Diffstat:
Melectrum/coinchooser.py | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/electrum/coinchooser.py b/electrum/coinchooser.py @@ -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