diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-03-24 14:56:11 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-03-24 14:59:51 +0100 |
commit | b88e0b0c610a6ff1aeaab136005e1ce600c4970d (patch) | |
tree | dec8ad59469b7becfbfd6a00ccb4b6e1c2a08ba9 | |
parent | 3ba07bdf7da40b77f2709ac9628b9d0d20c846e7 (diff) | |
parent | d6cc6a1830bb7e03701488ca30c46457434dec6c (diff) |
Merge #7506: Use CCoinControl selection in CWallet::FundTransaction
d6cc6a1 Use CCoinControl selection in CWallet::FundTransaction (João Barbosa)
-rw-r--r-- | src/coincontrol.h | 5 | ||||
-rw-r--r-- | src/qt/coincontroldialog.cpp | 2 | ||||
-rw-r--r-- | src/wallet/wallet.cpp | 13 |
3 files changed, 5 insertions, 15 deletions
diff --git a/src/coincontrol.h b/src/coincontrol.h index 9626ad2c5b..12fe9ce219 100644 --- a/src/coincontrol.h +++ b/src/coincontrol.h @@ -38,10 +38,9 @@ public: return (setSelected.size() > 0); } - bool IsSelected(const uint256& hash, unsigned int n) const + bool IsSelected(const COutPoint& output) const { - COutPoint outpt(hash, n); - return (setSelected.count(outpt) > 0); + return (setSelected.count(output) > 0); } void Select(const COutPoint& output) diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 7393c83c7d..f909499952 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -796,7 +796,7 @@ void CoinControlDialog::updateView() } // set checkbox - if (coinControl->IsSelected(txhash, out.i)) + if (coinControl->IsSelected(COutPoint(txhash, out.i))) itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Checked); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 7d1928dd6a..e85ccd2135 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1679,7 +1679,7 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const isminetype mine = IsMine(pcoin->vout[i]); if (!(IsSpent(wtxid, i)) && mine != ISMINE_NO && !IsLockedCoin((*it).first, i) && (pcoin->vout[i].nValue > 0 || fIncludeZeroValue) && - (!coinControl || !coinControl->HasSelected() || coinControl->fAllowOtherInputs || coinControl->IsSelected((*it).first, i))) + (!coinControl || !coinControl->HasSelected() || coinControl->fAllowOtherInputs || coinControl->IsSelected(COutPoint((*it).first, i)))) vCoins.push_back(COutput(pcoin, i, nDepth, ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (coinControl && coinControl->fAllowWatchOnly && (mine & ISMINE_WATCH_SOLVABLE) != ISMINE_NO))); @@ -1936,16 +1936,7 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount &nFeeRet, int& nC // Add new txins (keeping original txin scriptSig/order) BOOST_FOREACH(const CTxIn& txin, wtx.vin) { - bool found = false; - BOOST_FOREACH(const CTxIn& origTxIn, tx.vin) - { - if (txin.prevout.hash == origTxIn.prevout.hash && txin.prevout.n == origTxIn.prevout.n) - { - found = true; - break; - } - } - if (!found) + if (!coinControl.IsSelected(txin.prevout)) tx.vin.push_back(txin); } |