Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,883 Lines • ▼ Show 20 Lines | if (IsDeprecatedRPCEnabled(gArgs, "fundrawtransaction")) { | ||||
if (keepReserveKey) { | if (keepReserveKey) { | ||||
reservekey.KeepKey(); | reservekey.KeepKey(); | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
OutputType | |||||
CWallet::TransactionChangeType(const std::vector<CRecipient> &vecSend) { | |||||
// If -changetype is specified, always use that change type. | |||||
if (g_change_type != OutputType::NONE) { | |||||
return g_change_type; | |||||
} | |||||
// if g_address_type is legacy, use legacy address as change. | |||||
if (g_address_type == OutputType::LEGACY) { | |||||
return OutputType::LEGACY; | |||||
} | |||||
// else use g_address_type for change | |||||
return g_address_type; | |||||
} | |||||
bool CWallet::CreateTransaction(const std::vector<CRecipient> &vecSend, | bool CWallet::CreateTransaction(const std::vector<CRecipient> &vecSend, | ||||
CTransactionRef &tx, CReserveKey &reservekey, | CTransactionRef &tx, CReserveKey &reservekey, | ||||
Amount &nFeeRet, int &nChangePosInOut, | Amount &nFeeRet, int &nChangePosInOut, | ||||
std::string &strFailReason, | std::string &strFailReason, | ||||
const CCoinControl &coinControl, bool sign) { | const CCoinControl &coinControl, bool sign) { | ||||
Amount nValue = Amount::zero(); | Amount nValue = Amount::zero(); | ||||
int nChangePosRequest = nChangePosInOut; | int nChangePosRequest = nChangePosInOut; | ||||
unsigned int nSubtractFeeFromAmount = 0; | unsigned int nSubtractFeeFromAmount = 0; | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | assert(txNew.nLockTime < LOCKTIME_THRESHOLD); | ||||
bool ret; | bool ret; | ||||
ret = reservekey.GetReservedKey(vchPubKey, true); | ret = reservekey.GetReservedKey(vchPubKey, true); | ||||
if (!ret) { | if (!ret) { | ||||
strFailReason = | strFailReason = | ||||
_("Keypool ran out, please call keypoolrefill first"); | _("Keypool ran out, please call keypoolrefill first"); | ||||
return false; | return false; | ||||
} | } | ||||
LearnRelatedScripts(vchPubKey, g_change_type); | const OutputType change_type = TransactionChangeType(vecSend); | ||||
LearnRelatedScripts(vchPubKey, change_type); | |||||
jasonbcox: iirc LearnRelatedScripts wasn't backported either. | |||||
scriptChange = GetScriptForDestination( | scriptChange = GetScriptForDestination( | ||||
GetDestinationForKey(vchPubKey, g_change_type)); | GetDestinationForKey(vchPubKey, change_type)); | ||||
} | } | ||||
CTxOut change_prototype_txout(Amount::zero(), scriptChange); | CTxOut change_prototype_txout(Amount::zero(), scriptChange); | ||||
coin_selection_params.change_output_size = | coin_selection_params.change_output_size = | ||||
GetSerializeSize(change_prototype_txout, SER_DISK, 0); | GetSerializeSize(change_prototype_txout, SER_DISK, 0); | ||||
// Get the fee rate to use effective values in coin selection | // Get the fee rate to use effective values in coin selection | ||||
CFeeRate nFeeRateNeeded = | CFeeRate nFeeRateNeeded = | ||||
GetMinimumFeeRate(*this, coinControl, g_mempool); | GetMinimumFeeRate(*this, coinControl, g_mempool); | ||||
▲ Show 20 Lines • Show All 1,749 Lines • Show Last 20 Lines |
iirc LearnRelatedScripts wasn't backported either.