Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,721 Lines • ▼ Show 20 Lines | bool CWallet::SelectCoins(const std::vector<COutput> &vAvailableCoins, | ||||
setCoinsRet.insert(setPresetCoins.begin(), setPresetCoins.end()); | setCoinsRet.insert(setPresetCoins.begin(), setPresetCoins.end()); | ||||
// Add preset inputs to the total value selected. | // Add preset inputs to the total value selected. | ||||
nValueRet += nValueFromPresetInputs; | nValueRet += nValueFromPresetInputs; | ||||
return res; | return res; | ||||
} | } | ||||
bool CWallet::SignTransaction(CMutableTransaction &tx) { | |||||
// sign the new tx | |||||
CTransaction txNewConst(tx); | |||||
int nIn = 0; | |||||
for (auto &input : tx.vin) { | |||||
auto mi = mapWallet.find(input.prevout.GetTxId()); | |||||
if (mi == mapWallet.end() || | |||||
input.prevout.GetN() >= mi->second.tx->vout.size()) { | |||||
return false; | |||||
} | |||||
const CScript &scriptPubKey = | |||||
mi->second.tx->vout[input.prevout.GetN()].scriptPubKey; | |||||
const Amount amount = mi->second.tx->vout[input.prevout.GetN()].nValue; | |||||
SignatureData sigdata; | |||||
SigHashType sigHashType = SigHashType().withForkId(); | |||||
if (!ProduceSignature(TransactionSignatureCreator( | |||||
this, &txNewConst, nIn, amount, sigHashType), | |||||
scriptPubKey, sigdata)) { | |||||
return false; | |||||
} | |||||
UpdateTransaction(tx, nIn, sigdata); | |||||
nIn++; | |||||
} | |||||
return true; | |||||
} | |||||
bool CWallet::FundTransaction(CMutableTransaction &tx, Amount &nFeeRet, | bool CWallet::FundTransaction(CMutableTransaction &tx, Amount &nFeeRet, | ||||
bool overrideEstimatedFeeRate, | bool overrideEstimatedFeeRate, | ||||
const CFeeRate &specificFeeRate, | const CFeeRate &specificFeeRate, | ||||
int &nChangePosInOut, std::string &strFailReason, | int &nChangePosInOut, std::string &strFailReason, | ||||
bool includeWatching, bool lockUnspents, | bool includeWatching, bool lockUnspents, | ||||
const std::set<int> &setSubtractFeeFromOutputs, | const std::set<int> &setSubtractFeeFromOutputs, | ||||
bool keepReserveKey, | bool keepReserveKey, | ||||
const CTxDestination &destChange) { | const CTxDestination &destChange) { | ||||
▲ Show 20 Lines • Show All 1,703 Lines • Show Last 20 Lines |