Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 2,882 Lines • ▼ Show 20 Lines | bool CWallet::FundTransaction(CMutableTransaction &tx, Amount &nFeeRet, | ||||
return true; | return true; | ||||
} | } | ||||
OutputType | OutputType | ||||
CWallet::TransactionChangeType(OutputType change_type, | CWallet::TransactionChangeType(OutputType change_type, | ||||
const std::vector<CRecipient> &vecSend) { | const std::vector<CRecipient> &vecSend) { | ||||
// If -changetype is specified, always use that change type. | // If -changetype is specified, always use that change type. | ||||
if (change_type != OutputType::NONE) { | if (change_type != OutputType::CHANGE_AUTO) { | ||||
return change_type; | return change_type; | ||||
} | } | ||||
// if m_default_address_type is legacy, use legacy address as change. | // if m_default_address_type is legacy, use legacy address as change. | ||||
if (m_default_address_type == OutputType::LEGACY) { | if (m_default_address_type == OutputType::LEGACY) { | ||||
return OutputType::LEGACY; | return OutputType::LEGACY; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,676 Lines • ▼ Show 20 Lines | if (gArgs.IsArgSet("-paytxfee")) { | ||||
::minRelayTxFee.ToString())); | ::minRelayTxFee.ToString())); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
walletInstance->m_spend_zero_conf_change = | walletInstance->m_spend_zero_conf_change = | ||||
gArgs.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE); | gArgs.GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE); | ||||
walletInstance->m_default_address_type = DEFAULT_ADDRESS_TYPE; | walletInstance->m_default_address_type = DEFAULT_ADDRESS_TYPE; | ||||
walletInstance->m_default_change_type = OutputType::NONE; | walletInstance->m_default_change_type = DEFAULT_CHANGE_TYPE; | ||||
LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); | LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); | ||||
// Try to top up keypool. No-op if the wallet is locked. | // Try to top up keypool. No-op if the wallet is locked. | ||||
walletInstance->TopUpKeyPool(); | walletInstance->TopUpKeyPool(); | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
▲ Show 20 Lines • Show All 182 Lines • ▼ Show 20 Lines | bool ret = ::AcceptToMemoryPool( | ||||
nullptr /* pfMissingInputs */, false /* fOverrideMempoolLimit */, | nullptr /* pfMissingInputs */, false /* fOverrideMempoolLimit */, | ||||
nAbsurdFee); | nAbsurdFee); | ||||
fInMempool = ret; | fInMempool = ret; | ||||
return ret; | return ret; | ||||
} | } | ||||
static const std::string OUTPUT_TYPE_STRING_LEGACY = "legacy"; | static const std::string OUTPUT_TYPE_STRING_LEGACY = "legacy"; | ||||
OutputType ParseOutputType(const std::string &type, OutputType default_type) { | bool ParseOutputType(const std::string &type, OutputType &output_type) { | ||||
if (type.empty()) { | if (type == OUTPUT_TYPE_STRING_LEGACY) { | ||||
return default_type; | output_type = OutputType::LEGACY; | ||||
} else if (type == OUTPUT_TYPE_STRING_LEGACY) { | return true; | ||||
return OutputType::LEGACY; | |||||
} else { | |||||
return OutputType::NONE; | |||||
} | } | ||||
return false; | |||||
} | } | ||||
const std::string &FormatOutputType(OutputType type) { | const std::string &FormatOutputType(OutputType type) { | ||||
switch (type) { | switch (type) { | ||||
case OutputType::LEGACY: | case OutputType::LEGACY: | ||||
return OUTPUT_TYPE_STRING_LEGACY; | return OUTPUT_TYPE_STRING_LEGACY; | ||||
default: | default: | ||||
assert(false); | assert(false); | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |