|
Ran
|
Files
52
|
Run time
2s
|
Badge
README BADGES
|
push
github
Merge bitcoindevkit/bdk#1798: Refactor/use iterators to preselect utxos 2f83b4508 test(wallet): check there are no duplicates across required and optional utxos (nymius) 39df2b940 refactor(wallet): remove coin_selection::filter_duplicates (nymius) 79bd7da87 refactor(wallet): use iterators and adaptors in preselect_utxos (nymius) Pull request description: ### Description There were multiple calls for de-duplication of selected UTxOs in `Wallet::create_tx`: ([1](https://github.com/bitcoindevkit/bdk/blob/<a class=hub.com/bitcoindevkit/bdk/commit/abc305612160c0e2ce85c7bba4c2c162ff488adc">abc305612/crates/wallet/src/wallet/mod.rs#L2016-L2020)) and ([2](https://github.com/bitcoindevkit/bdk/blob/abc305612160c0e2ce85c7bba4c2c162ff488adc/crates/wallet/src/wallet/mod.rs#L1452)). As the test [`test_filter_duplicates`](https://github.com/bitcoindevkit/bdk/blob/master/crates/wallet/src/wallet/coin_selection.rs#L1666-L1695) 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`](https://github.com/bitcoindevkit/bdk/blob/a5335a184/crates/chain/src/tx_graph.rs#L911-L912) 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 does the following: - Refactors `TxParams::utxos` type to be `HashSet<LocalOutput>` avoiding the duplication case 3 - Ke... (continued)
12076 of 14987 relevant lines covered (80.58%)
14277.08 hits per line
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|