Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | static UniValue getnewaddress(const Config &config, | ||||
// Parse the label first so we don't generate a key if there's an error | // Parse the label first so we don't generate a key if there's an error | ||||
std::string label; | std::string label; | ||||
if (!request.params[0].isNull()) { | if (!request.params[0].isNull()) { | ||||
label = LabelFromValue(request.params[0]); | label = LabelFromValue(request.params[0]); | ||||
} | } | ||||
OutputType output_type = pwallet->m_default_address_type; | OutputType output_type = pwallet->m_default_address_type; | ||||
if (!request.params[1].isNull()) { | if (!request.params[1].isNull()) { | ||||
output_type = ParseOutputType(request.params[1].get_str(), | if (!ParseOutputType(request.params[1].get_str(), output_type)) { | ||||
pwallet->m_default_address_type); | |||||
if (output_type == OutputType::NONE) { | |||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
strprintf("Unknown address type '%s'", | strprintf("Unknown address type '%s'", | ||||
request.params[1].get_str())); | request.params[1].get_str())); | ||||
} | } | ||||
} | } | ||||
if (!pwallet->IsLocked()) { | if (!pwallet->IsLocked()) { | ||||
pwallet->TopUpKeyPool(); | pwallet->TopUpKeyPool(); | ||||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | static UniValue getrawchangeaddress(const Config &config, | ||||
} | } | ||||
LOCK2(cs_main, pwallet->cs_wallet); | LOCK2(cs_main, pwallet->cs_wallet); | ||||
if (!pwallet->IsLocked()) { | if (!pwallet->IsLocked()) { | ||||
pwallet->TopUpKeyPool(); | pwallet->TopUpKeyPool(); | ||||
} | } | ||||
OutputType output_type = pwallet->m_default_change_type != OutputType::NONE | OutputType output_type = | ||||
pwallet->m_default_change_type != OutputType::CHANGE_AUTO | |||||
? pwallet->m_default_change_type | ? pwallet->m_default_change_type | ||||
: pwallet->m_default_address_type; | : pwallet->m_default_address_type; | ||||
if (!request.params[0].isNull()) { | if (!request.params[0].isNull()) { | ||||
output_type = ParseOutputType(request.params[0].get_str(), output_type); | if (!ParseOutputType(request.params[0].get_str(), output_type)) { | ||||
if (output_type == OutputType::NONE) { | |||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
strprintf("Unknown address type '%s'", | strprintf("Unknown address type '%s'", | ||||
request.params[0].get_str())); | request.params[0].get_str())); | ||||
} | } | ||||
} | } | ||||
CReserveKey reservekey(pwallet); | CReserveKey reservekey(pwallet); | ||||
CPubKey vchPubKey; | CPubKey vchPubKey; | ||||
▲ Show 20 Lines • Show All 5,167 Lines • Show Last 20 Lines |