1

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?

3tbraden
  • 239
  • 1
  • 10

1 Answers1

2

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.

Pieter Wuille
  • 105,497
  • 9
  • 194
  • 308