-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADP-3272] Simplify handling of UTxOs in inner helper function of `ba…
…lanceTx`. (#4548) ## Issue ADP-3272 ## Description This PR simplifies the handling of UTxOs within the inner helper function of `balanceTransaction`, so that it only has to handle two UTxO-related data structures, both supplied by the outer function: - `utxoReference`: the set of all UTxOs (formerly known as `combinedUTxO`). - `utxoSelection`: the set of all UTxOs that the transaction is allowed to spend, along with a pre-selected subset. As a bonus, because this PR moves the computation of UTxO-related data structures from the inner helper function to the outer function, the above data structures should now be evaluated **_at most once_**, instead of multiple times (once per strategy). ## Notes The `balanceTransaction` function delegates the main portion of its work to an inner helper function that is parameterised by `SelectionStrategy`. It initially calls the inner helper function with `SelectionStrategyOptimal`, but if that strategy fails, then it (potentially) calls the inner helper function a **_second time_** with `SelectionStrategyMinimal`. In the event that the inner helper function is evaluated more than once (with two different strategies), we ideally want to avoid recomputing potentially expensive data structures that should be constant across both evaluations.
- Loading branch information
Showing
1 changed file
with
117 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters