ScopeLift / kaspa-wallet

👝 A web wallet for the Kaspa blockchain network
4 stars 2 forks source link

Use FIFO for UTXO Selection #82

Open apbendi opened 4 years ago

apbendi commented 4 years ago

Issue 6.3

FIFO by TransactionOutput.acceptingBlockBlueScore

wildmolasses commented 4 years ago

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.

ey51 commented 4 years ago

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.