Does any of the coin selection algorithms used in Bitcoin Core use 'tolerance' in it?

Context: Tolerance here is used for the amount that can be added to fees. In case of BnB if the user does not have enough coins, fees can be adjusted to avoid change


Yes, Bitcoin Core will permit slightly overshooting the selection target when using the Branch and Bound algorithm, as long as the overshoot is smaller than the cost of creating and spending a change output.

In the loop that evaluates input set candidates, the search will backtrack if the selected amount exceeds selection_target + cost_of_change, but if the selected amount is between selection_target and selection_target + cost_of_change, it'll consider the input set a solution candidate. enter image description here

You can find the relevant section of code in the function SelectCoinsBnB in src/wallet/coinselection.cpp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.