Skip to content

Commit

Permalink
Improve comment
Browse files Browse the repository at this point in the history
Improve comment that describes how we search for the oldest UTXO that is not
revealed.
  • Loading branch information
michalsmiarowski committed Aug 23, 2023
1 parent 58e41d9 commit 30d657f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/store/tbtc/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ export const findUtxoEffect = async (
let utxo = utxos[0]
let areAllDepositRevealed = true

// We have to find the first utxo that is revealed. The UTXOs returned
// from `findAllUnspentTransactionOutputs` are in reversed order so
// that's why we start our search from the last elements of the `utxos`.
// If all deposits are revealed then we just use the first utxo (which
// should be the most recent transaction)
// We have to find the first UTXO that is not revealed. The UTXOs
// returned from `findAllUnspentTransactionOutputs` are in reversed
// order so we have to start our search from the last element of the
// `utxos` so that we search them in the order they were done. We go
// through all of them up to the first one to find the oldest UTXO that
// is not revealed.
// If all deposits are revealed then we just use the first UTXO (which
// should be the most recent transaction).
for (let i = utxos.length - 1; i >= 0; i--) {
// Check if deposit is revealed.
const deposit = await forkApi.pause(
Expand Down

0 comments on commit 30d657f

Please sign in to comment.