1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-12-27 00:48:09 +00:00

Merge pull request #177 from kristjanr/develop

Fix unorderable types error&make code more uniform
This commit is contained in:
Andreas M. Antonopoulos 2016-12-16 16:37:05 +02:00 committed by GitHub
commit 572667c69c

View File

@ -26,9 +26,9 @@ def select_outputs_greedy(unspent, min_value):
key_func = lambda utxo: utxo.value key_func = lambda utxo: utxo.value
if greaters: if greaters:
# Not-empty. Find the smallest greater. # Not-empty. Find the smallest greater.
min_greater = min(greaters) min_greater = min(greaters, key=key_func)
change = min_greater.value - min_value change = min_greater.value - min_value
return [min_greater], change return [min_greater], "Change: %d Satoshis" % change
# Not found in greaters. Try several lessers instead. # Not found in greaters. Try several lessers instead.
# Rearrange them from biggest to smallest. We want to use the least # Rearrange them from biggest to smallest. We want to use the least
# amount of inputs as possible. # amount of inputs as possible.