BnB is one of the best coin selection algorithms existing and its implementation is in the Bitcoin source code. But as seen from this line: https://github.com/bitcoin/bitcoin/blob/f72d80b07af8ecbb2f9df1e87344eb465186f19d/src/wallet/wallet.cpp#L2403 it is not enabled by default. Why is that or have I been mistaken?

1 Answer 1


You're misunderstanding the code. That variable tracks whether BnB was used. Not whether we attempt to use it.

BnB does not always yield an acceptable result, as it requires a solution with no change to exist. It is attempted, but if no such solution can be found, Bitcoin Core's coin selection falls back to other algorithms. The bnb_used variable remembers whether that was the case.

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.