mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-07-13 15:39:52 +02:00
7249b376a0opt: Skip UTXOs with worse waste, same eff_value (Murch)5204291860opt: Skip evaluation of equivalent input sets (Murch)ba1807b981coinselection: Track effective_value lookahead (Murch)fa226ab902coinselection: BnB skip exploring high waste (Murch)7ecea1dc5dcoinselection: Track whether BnB completed (Murch)3ca0f36164coinselection: rewrite BnB in CoinGrinder-style (Murch)2e73739837coinselection: Track BnB iteration count in result (Murch) Pull request description: This PR rewrites the implementation of the BnB coinselection algorithm to skip the duplicate evaluation of previously visited input selections. In the original implementation of BnB, the state of the search is backtracked by explicitly walking back to the omission branch and then testing again. This retests an equivalent candidate set as before, e.g., after backtracking from {ABC}, it would evaluate {AB_}, before trying {AB_D}, but {AB_} is equivalent to {AB} which was tested before. CoinGrinder tracks the state of the search instead by remembering which UTXO was last added and explicitly shifting from that UTXO directly to the next, so after {ABC}, it will immediately move on to {AB_D}. We replicate this approach here. As fewer nodes are visited, this approach will enumerate more possible combinations than the original implementation given the same limit for iterations. ACKs for top commit: achow101: ACK7249b376a0w0xlt: reACK7249b376a0Tree-SHA512: fd5851ceea3a3a4699fc062254fa5438daa4275b4d52325983e63670040cf0ba35112be9e63813d8f30b38993c031f3df343b2152eb8c068d272fbff72d1881a