Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,808 Lines • ▼ Show 20 Lines | bool CWallet::FundTransaction(CMutableTransaction &tx, Amount &nFeeRet, | ||||
} | } | ||||
coinControl.fAllowOtherInputs = true; | coinControl.fAllowOtherInputs = true; | ||||
for (const CTxIn &txin : tx.vin) { | for (const CTxIn &txin : tx.vin) { | ||||
coinControl.Select(txin.prevout); | coinControl.Select(txin.prevout); | ||||
} | } | ||||
// Acquire the locks to prevent races to the new locked unspents between the | |||||
// CreateTransaction call and LockCoin calls (when lockUnspents is true). | |||||
LOCK2(cs_main, cs_wallet); | |||||
CReserveKey reservekey(this); | CReserveKey reservekey(this); | ||||
CTransactionRef tx_new; | CTransactionRef tx_new; | ||||
if (!CreateTransaction(vecSend, tx_new, reservekey, nFeeRet, | if (!CreateTransaction(vecSend, tx_new, reservekey, nFeeRet, | ||||
nChangePosInOut, strFailReason, coinControl, | nChangePosInOut, strFailReason, coinControl, | ||||
false)) { | false)) { | ||||
return false; | return false; | ||||
} | } | ||||
Show All 15 Lines | bool CWallet::FundTransaction(CMutableTransaction &tx, Amount &nFeeRet, | ||||
} | } | ||||
// Add new txins (keeping original txin scriptSig/order) | // Add new txins (keeping original txin scriptSig/order) | ||||
for (const CTxIn &txin : tx_new->vin) { | for (const CTxIn &txin : tx_new->vin) { | ||||
if (!coinControl.IsSelected(txin.prevout)) { | if (!coinControl.IsSelected(txin.prevout)) { | ||||
tx.vin.push_back(txin); | tx.vin.push_back(txin); | ||||
if (lockUnspents) { | if (lockUnspents) { | ||||
LOCK2(cs_main, cs_wallet); | |||||
LockCoin(txin.prevout); | LockCoin(txin.prevout); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// DEPRECATED, remove in 0.20 with -reserveChangeKey | // DEPRECATED, remove in 0.20 with -reserveChangeKey | ||||
// Optionally keep the change output key. | // Optionally keep the change output key. | ||||
if (IsDeprecatedRPCEnabled(gArgs, "fundrawtransaction")) { | if (IsDeprecatedRPCEnabled(gArgs, "fundrawtransaction")) { | ||||
▲ Show 20 Lines • Show All 1,720 Lines • Show Last 20 Lines |