user85343: 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?

user208: 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.

85343: <p>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: <a href="https://github.com/bitcoin/bitcoin/blob/f72d80b07af8ecbb2f9df1e87344eb465186f19d/src/wallet/wallet.cpp#L2403" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/f72d80b07af8ecbb2f9df1e87344eb465186f19d/src/wallet/wallet.cpp#L2403</a> it is not enabled by default. Why is that or have I been mistaken?</p>
 208: <p>You're misunderstanding the code. That variable tracks whether BnB <em>was</em> used. Not whether we attempt to use it.</p>
<p>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 <code>bnb_used</code> variable remembers whether that was the case.</p>
