Author

Topic: What's the reasoning behind the "DoubleValue" Coin Selection code? (Read 1394 times)

legendary
Activity: 3766
Merit: 1364
Armory Developer
I haven't touched this part of the code so I don't know for sure. You should CircusPeanut since he's the last to have modified it (iirc).

This is the comment in PySelectCoins() that calls this method:

Quote
   Intense algorithm for coin selection:  computes about 30 different ways to
   select coins based on the desired target output and the min tx fee.  Then
   ranks the various solutions and picks the best one

This is my guess: if you have to have change you would rather avoid tiny amounts, or you'll have to consolidate all these small amounts at some point, and that will command a large fee. If you have UTXOs with about double the amount you want to spend, you can create a small Tx (1 input) with a large change UTXO.
newbie
Activity: 30
Merit: 0
the comment on PySelectCoins_SingleInput_DoubleValue is a bit vague and I was urious what this way of selecting coins is supposed to achieve?

Quote
We will look for a single input that is within 30% of the target
In case the tx value is tiny rel to the fee: the minTarget calc may fail to exceed the actual tx size needed, so we add an extra
We restrain the search to 25%.  If there is no one output in this range, then we will return nothing, and the SingleInput_SingleValue method might return a usable result

Jump to: