refactor(wallet): use iterators and adaptors in preselect_utxos
There were multiple calls for de-duplication of selected UTxOs.
As the test `test_filter_duplicates` shows, there are four possible
cases for duplication of UTxOs while feeding the coin selection
algorithms.
1. no duplication: out of concern
2. duplication in the required utxos only: covered by the source of
`required_utxos`, `Wallet::list_unspent`, which roots back the
provided `UTxOs` to a `HashMap` which should avoid any duplication by
definition
3. duplication in the optional utxos only: is the only one possible as
optional `UTxOs` are stored in a `Vec` and no checks are performed
about the duplicity of their members.
4. duplication across the required and optional utxos: is already
covered by `Wallet::preselect_utxos`, which avoid the processing of
required UTxOs while listing the unspent available UTxOs in the
wallet.
This refactor changes:
- `TxParams::utxos` type to be `HashSet<LocalOutput>` avoiding the
duplication case 3, and allowing a query closer to O(1) on avg. to
cover duplication case 4 (before was O(n) where n is the size of
required utxos).
- Moves the computation of the `WeightedUtxos` to the last part of UTxO
filtering, allowing the unification of the computation for local
outputs.
- Removes some extra allocations done for helpers structures or
intermediate results while filtering UTxOs.
- Allows for future integration of UTxO filtering methods for other
utilities.
- Adds more comments for each filtering step.
With these changes all four cases would be covered, and
`coin_selection::filter_duplicates` would be no longer needed.