diff options
author | Andrew Chow <achow101-github@achow101.com> | 2019-11-25 02:19:57 -0500 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-11-26 13:02:46 -0500 |
commit | ff330badd45067cb520b1cfa1844f60a4c9f2031 (patch) | |
tree | cad0b5bb7362c49534382cf0c6286aa69110f93e | |
parent | 0b79caf658019de2c65a53c9e11fd1d2f4c369b6 (diff) |
Default to bnb_used = false as there are many cases where BnB is not used
-rw-r--r-- | src/wallet/wallet.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index b1e1385ca3..647b381b39 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2270,12 +2270,12 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm std::vector<COutput> vCoins(vAvailableCoins); CAmount value_to_select = nTargetValue; + // Default to bnb was not used. If we use it, we set it later + bnb_used = false; + // coin control -> return all selected outputs (we want all selected to go into the transaction for sure) if (coin_control.HasSelected() && !coin_control.fAllowOtherInputs) { - // We didn't use BnB here, so set it to false. - bnb_used = false; - for (const COutput& out : vCoins) { if (!out.fSpendable) @@ -2300,14 +2300,12 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm const CWalletTx& wtx = it->second; // Clearly invalid input, fail if (wtx.tx->vout.size() <= outpoint.n) { - bnb_used = false; return false; } // Just to calculate the marginal byte size CInputCoin coin(wtx.tx, outpoint.n, wtx.GetSpendSize(outpoint.n, false)); nValueFromPresetInputs += coin.txout.nValue; if (coin.m_input_bytes <= 0) { - bnb_used = false; return false; // Not solvable, can't estimate size for fee } coin.effective_value = coin.txout.nValue - coin_selection_params.effective_fee.GetFee(coin.m_input_bytes); @@ -2318,7 +2316,6 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm } setPresetCoins.insert(coin); } else { - bnb_used = false; return false; // TODO: Allow non-wallet inputs } } @@ -2678,7 +2675,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std } // Choose coins to use - bool bnb_used; + bool bnb_used = false; if (pick_new_inputs) { nValueIn = 0; setCoins.clear(); |