fix(coin_selection): calculate_cs_result returns the required UTXOs first#390
Open
ValuedMammal wants to merge 2 commits intobitcoindevkit:masterfrom
Open
fix(coin_selection): calculate_cs_result returns the required UTXOs first#390ValuedMammal wants to merge 2 commits intobitcoindevkit:masterfrom
calculate_cs_result returns the required UTXOs first#390ValuedMammal wants to merge 2 commits intobitcoindevkit:masterfrom
Conversation
… first Previously `calculate_cs_result` produced a CoinSelectionResult by appending the required utxos onto the selected ones, which changed the order of transaction inputs when TxOrdering::Untouched was specified. The intended behavior is for the order of the inputs to match the order in which the utxos were added to the TxBuilder. We fix this by extending the required_utxos Vec with the selected_utxos before returning the CoinSelectionResult.
…ering_bnb_success` The test is set up in such a way that BnB can find a solution and demonstrates that `calculate_cs_result` correctly places required UTXOs before selected ones.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #390 +/- ##
=======================================
Coverage 79.17% 79.17%
=======================================
Files 24 24
Lines 5311 5312 +1
Branches 242 242
=======================================
+ Hits 4205 4206 +1
Misses 1029 1029
Partials 77 77
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #262 that addresses transaction input ordering when BnB finds a solution.
Previously
calculate_cs_resultproduced a CoinSelectionResult by appending the required UTXOs onto the selected ones, which changed the expected order of transaction inputs.calculate_cs_resultnow returns the required UTXOs before the newly selected ones. This behavior aligns with the expectation that the order of manually selected inputs should be preserved in the final transaction wheneverTxOrdering::Untouchedis specified.For related discussion refer to #244 (comment).
Changelog notice
Fixed
BranchAndBoundCoinSelection, required UTXOs come firstChecklists
All Submissions:
Bugfixes: