Skip to content

Commit

Permalink
Move definitions back to do block to minimise overall diff.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Apr 18, 2024
1 parent 10fed7e commit a4b744a
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs
Expand Up @@ -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.
--
Expand Down

0 comments on commit a4b744a

Please sign in to comment.