From 6ef99826b9ab2c9d95ed4b55403d22225bcf086a Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Thu, 15 Mar 2018 02:42:18 -0400 Subject: [PATCH] Actually disable BnB when there are preset inputs We don't want to use BnB when there are preset inputs because there is some weirdness with making that work with using the KnapsackSolver as the fallback. Currently we say that we haven't used bnb when there are preset inputs, but we don't actually disable BnB. This fixes that. --- src/wallet/wallet.cpp | 3 ++- src/wallet/wallet.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index bd5094085..db63a5a85 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2493,7 +2493,7 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const CoinEligibil } } -bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set& setCoinsRet, CAmount& nValueRet, const CCoinControl& coin_control, const CoinSelectionParams& coin_selection_params, bool& bnb_used) const +bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set& setCoinsRet, CAmount& nValueRet, const CCoinControl& coin_control, CoinSelectionParams& coin_selection_params, bool& bnb_used) const { std::vector vCoins(vAvailableCoins); @@ -2523,6 +2523,7 @@ bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAm { // For now, don't use BnB if preset inputs are selected. TODO: Enable this later bnb_used = false; + coin_selection_params.use_bnb = false; std::map::const_iterator it = mapWallet.find(outpoint.hash); if (it != mapWallet.end()) diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index dc0e8d07d..a88da71f9 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -674,7 +674,7 @@ private: * if they are not ours */ bool SelectCoins(const std::vector& vAvailableCoins, const CAmount& nTargetValue, std::set& setCoinsRet, CAmount& nValueRet, - const CCoinControl& coin_control, const CoinSelectionParams& coin_selection_params, bool& bnb_used) const; + const CCoinControl& coin_control, CoinSelectionParams& coin_selection_params, bool& bnb_used) const; CWalletDB *pwalletdbEncryption;