Browse Source
coinchooser: tweak heuristic scoring.
transactions without any change now get better scores.
transactions with really small change get worse scores.
dependabot/pip/contrib/deterministic-build/ecdsa-0.13.3
SomberNight
6 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
6 additions and
1 deletions
-
electrum/coinchooser.py
|
@ -413,8 +413,13 @@ class CoinChooserPrivacy(CoinChooserRandom): |
|
|
tx, change_outputs = tx_from_buckets(buckets) |
|
|
tx, change_outputs = tx_from_buckets(buckets) |
|
|
change = sum(o.value for o in change_outputs) |
|
|
change = sum(o.value for o in change_outputs) |
|
|
# Penalize change not roughly in output range |
|
|
# 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) |
|
|
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: |
|
|
elif change > max_change: |
|
|
badness += (change - max_change) / (max_change + 10000) |
|
|
badness += (change - max_change) / (max_change + 10000) |
|
|
# Penalize large change; 5 BTC excess ~= using 1 more input |
|
|
# Penalize large change; 5 BTC excess ~= using 1 more input |
|
|