From ddc92db695568f529daafcb3acdf3a6b49be706c Mon Sep 17 00:00:00 2001 From: Tomasz Slabon Date: Wed, 27 Sep 2023 11:07:41 +0200 Subject: [PATCH] Renamed UTXO value sum variable --- typescript/src/deposit-sweep.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/typescript/src/deposit-sweep.ts b/typescript/src/deposit-sweep.ts index 0e744c370..2d63ad0a6 100644 --- a/typescript/src/deposit-sweep.ts +++ b/typescript/src/deposit-sweep.ts @@ -161,15 +161,15 @@ export async function assembleDepositSweepTransaction( ) // Calculate the value of transaction's output. Note that the value of fee - // needs to be subtracted from the sum. - let totalInputValue = BigNumber.from(0) + // needs to be subtracted from the sum of UTXO values. + let outputValue = BigNumber.from(0) if (mainUtxo) { - totalInputValue = totalInputValue.add(mainUtxo.value) + outputValue = outputValue.add(mainUtxo.value) } for (const utxo of utxos) { - totalInputValue = totalInputValue.add(utxo.value) + outputValue = outputValue.add(utxo.value) } - totalInputValue = totalInputValue.sub(fee) + outputValue = outputValue.sub(fee) // Create the transaction. const transaction = new Transaction() @@ -190,7 +190,7 @@ export async function assembleDepositSweepTransaction( // Add transaction output. const scriptPubKey = address.toOutputScript(walletAddress, network) - transaction.addOutput(scriptPubKey, totalInputValue.toNumber()) + transaction.addOutput(scriptPubKey, outputValue.toNumber()) // Sign the main UTXO input if there is main UTXO. if (mainUtxo) {