Use FIFO for UTXO Selection
apbendi opened this issue · 2 comments
Issue 6.3
FIFO by TransactionOutput.acceptingBlockBlueScore
Slight architectural change needed
Currently Api.Utxo[]
are being optimistically transformed to bitcore.UnspentOutput[]
. But we want to defer this until actual tx compose time. Then we can order by Api.Utxo.acceptingBlockBlueScore
.
The goal here is to avoid double paying, by using the consensus's enforcement of no doublespending the same utxo. If transaction selection is random (as now), and the user has many utxo, there is a chance that two separate sends would result in selecting two non-overlapping sets of utxo. Deterministically choosing at least one overlapping utxo when composing a transaction would result in the consensus enforcing that only one of the transactions sent to the network will ever get accepted.
Any solution that achieves this is acceptable.