Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show All 13 Lines | |||||
#include "fs.h" | #include "fs.h" | ||||
#include "init.h" | #include "init.h" | ||||
#include "key.h" | #include "key.h" | ||||
#include "keystore.h" | #include "keystore.h" | ||||
#include "net.h" | #include "net.h" | ||||
#include "policy/policy.h" | #include "policy/policy.h" | ||||
#include "primitives/block.h" | #include "primitives/block.h" | ||||
#include "primitives/transaction.h" | #include "primitives/transaction.h" | ||||
#include "rpc/server.h" | |||||
#include "scheduler.h" | #include "scheduler.h" | ||||
#include "script/script.h" | #include "script/script.h" | ||||
#include "script/sighashtype.h" | #include "script/sighashtype.h" | ||||
#include "script/sign.h" | #include "script/sign.h" | ||||
#include "timedata.h" | #include "timedata.h" | ||||
#include "txmempool.h" | #include "txmempool.h" | ||||
#include "ui_interface.h" | #include "ui_interface.h" | ||||
#include "util.h" | #include "util.h" | ||||
▲ Show 20 Lines • Show All 2,753 Lines • ▼ Show 20 Lines | if (!CreateTransaction(vecSend, tx_new, reservekey, nFeeRet, | ||||
nChangePosInOut, strFailReason, coinControl, | nChangePosInOut, strFailReason, coinControl, | ||||
false)) { | false)) { | ||||
return false; | return false; | ||||
} | } | ||||
if (nChangePosInOut != -1) { | if (nChangePosInOut != -1) { | ||||
tx.vout.insert(tx.vout.begin() + nChangePosInOut, | tx.vout.insert(tx.vout.begin() + nChangePosInOut, | ||||
tx_new->vout[nChangePosInOut]); | tx_new->vout[nChangePosInOut]); | ||||
// we dont have the normal Create/Commit cycle, and dont want to | |||||
// risk reusing change, so just remove the key from the keypool | |||||
// here. | |||||
if (!IsDeprecatedRPCEnabled(gArgs, "fundrawtransaction")) { | |||||
reservekey.KeepKey(); | |||||
} | |||||
} | } | ||||
// Copy output sizes from new transaction; they may have had the fee | // Copy output sizes from new transaction; they may have had the fee | ||||
// subtracted from them. | // subtracted from them. | ||||
for (size_t idx = 0; idx < tx.vout.size(); idx++) { | for (size_t idx = 0; idx < tx.vout.size(); idx++) { | ||||
tx.vout[idx].nValue = tx_new->vout[idx].nValue; | tx.vout[idx].nValue = tx_new->vout[idx].nValue; | ||||
} | } | ||||
// 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); | LOCK2(cs_main, cs_wallet); | ||||
LockCoin(txin.prevout); | LockCoin(txin.prevout); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// DEPRECATED, remove in 0.20 with -reserveChangeKey | |||||
// Optionally keep the change output key. | // Optionally keep the change output key. | ||||
if (keepReserveKey) { | if (keepReserveKey) { | ||||
reservekey.KeepKey(); | reservekey.KeepKey(); | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,649 Lines • Show Last 20 Lines |