aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorJoão Barbosa <joao@uphold.com>2016-04-06 15:56:14 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-04-15 15:36:05 +0200
commitf2d0944eb372838e05c666ce9b3df119d7da5594 (patch)
treedc4ecb77376030b326930abc247133766aee5e9b /src/wallet/wallet.cpp
parentaf4fe7fd126eff2dd1942276ea91c8ab9dd717c6 (diff)
downloadbitcoin-f2d0944eb372838e05c666ce9b3df119d7da5594.tar.xz
Add lockUnspents option to fundrawtransaction
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index ee92552168..8161c659ab 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1932,7 +1932,7 @@ bool CWallet::SelectCoins(const vector<COutput>& vAvailableCoins, const CAmount&
return res;
}
-bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nChangePosInOut, std::string& strFailReason, bool includeWatching, const CTxDestination& destChange)
+bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nChangePosInOut, std::string& strFailReason, bool includeWatching, bool lockUnspents, const CTxDestination& destChange)
{
vector<CRecipient> vecSend;
@@ -1962,7 +1962,15 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nC
BOOST_FOREACH(const CTxIn& txin, wtx.vin)
{
if (!coinControl.IsSelected(txin.prevout))
+ {
tx.vin.push_back(txin);
+
+ if (lockUnspents)
+ {
+ LOCK2(cs_main, cs_wallet);
+ LockCoin(txin.prevout);
+ }
+ }
}
return true;