From a4b744a17f4cf3b0c46571c809dd44857aec7692 Mon Sep 17 00:00:00 2001 From: Jonathan Knowles Date: Thu, 18 Apr 2024 07:13:35 +0000 Subject: [PATCH] Move definitions back to `do` block to minimise overall diff. --- .../Internal/Cardano/Write/Tx/Balance.hs | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs index 4314bd6dc35..1bf0f4ec63f 100644 --- a/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs +++ b/lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs @@ -543,33 +543,26 @@ balanceTransaction when (UTxOSelection.availableSize utxoSelection == 0) $ throwE ErrBalanceTxUnableToCreateInput - balanceWith utxoSelection SelectionStrategyOptimal + let adjustedPartialTx = assignMinimalAdaQuantitiesToOutputsWithoutAda pp tx + balanceWith strategy = + balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment + pp + timeTranslation + utxoAssumptions + utxoReference + utxoSelection + genChange + s + strategy + redeemers + timelockKeyWitnessCounts + adjustedPartialTx + balanceWith SelectionStrategyOptimal `catchE` \e -> if minimalStrategyIsWorthTrying e - then balanceWith utxoSelection SelectionStrategyMinimal + then balanceWith SelectionStrategyMinimal else throwE e where - adjustedPartialTx :: Tx era - adjustedPartialTx = assignMinimalAdaQuantitiesToOutputsWithoutAda pp tx - - balanceWith - :: UTxOSelection WalletUTxO - -> SelectionStrategy - -> ExceptT (ErrBalanceTx era) m (Tx era, changeState) - balanceWith utxoSelection strategy = - balanceTransactionWithSelectionStrategyAndNoZeroAdaAdjustment - pp - timeTranslation - utxoAssumptions - utxoReference - utxoSelection - genChange - s - strategy - redeemers - timelockKeyWitnessCounts - adjustedPartialTx - -- Creates an index of all UTxOs that are already spent as inputs of the -- partial transaction. --