Commit d0ba53c
committed
Merge bitcoindevkit#265: Prefer Utxo::Local over Utxo::Foreign in OldestFirstCoinSelection
345cc6e fix(coin_selection): prefer Utxo::Local over Utxo::Foreign in OldestFirstCoinSelection (nymius)
Pull request description:
### Description
The comments in the `OldestFirstCoinSelection` implementation stated the following:
> // For utxo that doesn't exist in DB, they will have lowest priority to be selected
But this was not honored in the code.
This PR enforces this and ensures the expected behaviour through the two following new tests:
- `test_oldest_first_coin_selection_uses_all_optional_with_foreign_utxo_locals_sorted_first`
- `test_oldest_first_coin_selection_uses_only_all_optional_local_utxos_not_a_single_foreign`
Fixes bitcoindevkit#264
### Changelog notice
No public APIs are changed by these commits.
### Checklists
> [!IMPORTANT]
> This pull request **DOES NOT** break the existing API
* [x] I've signed all my commits
* [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
* [x] I ran `cargo +nightly fmt` and `cargo clippy` before committing
* [x] I've added tests for the new code
* [x] I've expanded docs addressing new code
* [x] I've added tests to reproduce the issue which are now passing
* [x] I'm linking the issue being fixed by this PR
ACKs for top commit:
ValuedMammal:
ACK 345cc6e
oleonardolima:
ACK 345cc6e
Tree-SHA512: 8a538e0765ca55f870fcbc33e4c865656e9074765a5bb13c370afe2626dbf3ecbb71e8a372607e1e405a9e35f26418bfdd9c71fec018999858a5fe5680af866b1 file changed
Lines changed: 83 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
| 279 | + | |
279 | 280 | | |
280 | 281 | | |
281 | | - | |
282 | | - | |
| 282 | + | |
| 283 | + | |
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| |||
726 | 727 | | |
727 | 728 | | |
728 | 729 | | |
729 | | - | |
| 730 | + | |
730 | 731 | | |
731 | 732 | | |
732 | 733 | | |
| 734 | + | |
733 | 735 | | |
734 | 736 | | |
735 | 737 | | |
| |||
778 | 780 | | |
779 | 781 | | |
780 | 782 | | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
781 | 807 | | |
782 | 808 | | |
783 | 809 | | |
| |||
1051 | 1077 | | |
1052 | 1078 | | |
1053 | 1079 | | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
1054 | 1133 | | |
1055 | 1134 | | |
1056 | 1135 | | |
| |||
0 commit comments