I wanted to open an issue to understand why `bnb_search` as [implemented](https://github.com/bitcoin/bitcoin/pull/10637) @achow101 does not terminate once an optimal search is found.  This behavior is evident I believe when inspecting the [test](https://github.com/bitcoin/bitcoin/blob/master/src/wallet/test/coinselector_tests.cpp#L178) which sets the target to `5` and uses the utxo pool `4,3,2,1`.  since combinations of `4` are evaluated first, the `bnb_search` finds an optimal solution of `4,1`.  However, instead of terminating when the `best_waste = 0` (no better solution can be found), the search continues and instead finds another solution `2,3` which also has a `best_waste = 0`.  Why not terminate once an optimal solution is found instead of continuing to search?
add_coin(*wallet, 3 * CENT, 6 * 24, false, 0, true);
        add_coin(*wallet, 2 * CENT, 6 * 24, false, 0, true);
        CCoinControl coin_control;
        coin_control.fAllowOtherInputs = true;
        coin_control.Select(COutPoint(vCoins.at(0).tx->GetHash(), vCoins.at(0).i));
        coin_selection_params_bnb.effective_fee = CFeeRate(0);
        BOOST_CHECK(wallet->SelectCoins(vCoins, 10 * CENT, setCoinsRet, nValueRet, coin_control, coin_selection_params_bnb, bnb_used));
        BOOST_CHECK(bnb_used);
        BOOST_CHECK(coin_selection_params_bnb.use_bnb);
    }
}
BOOST_AUTO_TEST_CASE(knapsack_solver_test)
{
    CoinSet setCoinsRet, setCoinsRet2;
    CAmount nValueRet;
    bool bnb_used;
    LOCK(testWallet.cs_wallet);
    testWallet.SetupLegacyScriptPubKeyMan();
    
    for (int i = 0; i < RUN_TESTS; i++)
    {
        empty_wallet();
        
        BOOST_CHECK(!testWallet.SelectCoinsMinConf( 1 * CENT, filter_standard, GroupCoins(vCoins), setCoinsRet, nValueRet, coin_selection_params, bnb_used));
        add_coin(1*CENT, 4);        
        
        BOOST_CHECK(!testWallet.SelectCoinsMinConf( 1 * CENT, filter_standard, GroupCoins(vCoins), setCoinsRet, nValueRet, coin_selection_params, bnb_used));
        
        BOOST_CHECK( testWallet.SelectCoinsMinConf( 1 * CENT, filter_confirmed, GroupCoins(vCoins), setCoinsRet, nValueRet, coin_selection_params, bnb_used));
        BOOST_CHECK_EQUAL(nValueRet, 1 * CENT);