Skip to content

Commit 3bebbae

Browse files
committed
update comments
1 parent e7bb436 commit 3bebbae

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/mesh-transaction/src/mesh-tx-builder/coin-selection/largest-first-selector.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ const computeNetImplicitSelectionValues = (
143143
* each needed token type, and then filling in with smaller UTxOs as needed.
144144
*/
145145
export class LargestFirstInputSelector implements IInputSelector {
146-
// Change outputs will be computed
147-
// dummy output field is used to indicate that these outputs are not real
148-
// and so we will not check whether there is enough value to cover min utxo value
146+
// Change outputs will be computed, and an indicator will be
147+
// returned to indicate whether the value is fully fulfilled or not.
148+
// If the value is not fully fulfilled, it means that inputs were not enough
149+
// to cover the required value
149150
private computeChangeOutputs = (
150151
remainingValue: Value,
151152
changeAddress: string,
@@ -155,7 +156,7 @@ export class LargestFirstInputSelector implements IInputSelector {
155156
let valueFulfilled = true;
156157
const valueAssets = remainingValue
157158
.entries()
158-
.filter(([unit, quantity]) => quantity > 0n)
159+
.filter(([_, quantity]) => quantity > 0n)
159160
.map(([unit, quantity]) => ({
160161
unit,
161162
quantity: String(quantity),
@@ -234,7 +235,8 @@ export class LargestFirstInputSelector implements IInputSelector {
234235
amount: valueAssets,
235236
});
236237
if (lovelaceAvailable < 0n) {
237-
// If there's not enough lovelace to cover the min UTxO value, we set valueFulfilled to false
238+
// lovelaceAvailable being negative means that we didn't have enough
239+
// lovelaces to cover fees, we set valueFulfilled to false
238240
valueFulfilled = false;
239241
}
240242
}

0 commit comments

Comments
 (0)