cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
764 stars 212 forks source link

[ADP-3272] Simplify creation of preselected UTxO index. #4552

Closed jonathanknowles closed 5 months ago

jonathanknowles commented 5 months ago

This PR uses built-in Set and Map operations to simplify the creation of the "index of preselected UTxOs" (formerly known as the "externally selected UTxO index") within balanceTx.

Context

The caller of balanceTx can provide a partial transaction that already has inputs. These inputs must resolve to UTxOs in the reference UTxO set. Provided that all inputs can be resolved, we then construct an index of preselected UTxOs. If one or more inputs cannot be resolved, we fail with ErrBalanceTxUnresolvedInputs.

Issue

ADP-3272

Performance

Mean and standard deviation of CPU time over 8 runs of cabal test cardano-balance-tx:

Version Mean Standard Deviation
Before 42.7 s 2.7 s
After 41.6 s 1.8 s

(no significant change)