Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 3,689 Lines • ▼ Show 20 Lines | if (!options.isNull()) { | ||||
coinControl.fAllowWatchOnly = options.get_bool(); | coinControl.fAllowWatchOnly = options.get_bool(); | ||||
} else { | } else { | ||||
RPCTypeCheckArgument(options, UniValue::VOBJ); | RPCTypeCheckArgument(options, UniValue::VOBJ); | ||||
RPCTypeCheckObj( | RPCTypeCheckObj( | ||||
options, | options, | ||||
{ | { | ||||
{"add_inputs", UniValueType(UniValue::VBOOL)}, | {"add_inputs", UniValueType(UniValue::VBOOL)}, | ||||
{"changeAddress", UniValueType(UniValue::VSTR)}, | {"changeAddress", UniValueType(UniValue::VSTR)}, | ||||
{"change_address", UniValueType(UniValue::VSTR)}, | |||||
{"changePosition", UniValueType(UniValue::VNUM)}, | {"changePosition", UniValueType(UniValue::VNUM)}, | ||||
{"change_position", UniValueType(UniValue::VNUM)}, | |||||
{"includeWatching", UniValueType(UniValue::VBOOL)}, | {"includeWatching", UniValueType(UniValue::VBOOL)}, | ||||
{"include_watching", UniValueType(UniValue::VBOOL)}, | |||||
{"lockUnspents", UniValueType(UniValue::VBOOL)}, | {"lockUnspents", UniValueType(UniValue::VBOOL)}, | ||||
{"lock_unspents", UniValueType(UniValue::VBOOL)}, | |||||
// will be checked below | // will be checked below | ||||
{"feeRate", UniValueType()}, | {"feeRate", UniValueType()}, | ||||
{"fee_rate", UniValueType()}, | |||||
{"subtractFeeFromOutputs", UniValueType(UniValue::VARR)}, | {"subtractFeeFromOutputs", UniValueType(UniValue::VARR)}, | ||||
{"subtract_fee_from_outputs", UniValueType(UniValue::VARR)}, | |||||
}, | }, | ||||
true, true); | true, true); | ||||
if (options.exists("add_inputs")) { | if (options.exists("add_inputs")) { | ||||
coinControl.m_add_inputs = options["add_inputs"].get_bool(); | coinControl.m_add_inputs = options["add_inputs"].get_bool(); | ||||
} | } | ||||
if (options.exists("changeAddress")) { | if (options.exists("changeAddress") || | ||||
CTxDestination dest = | options.exists("change_address")) { | ||||
DecodeDestination(options["changeAddress"].get_str(), | const std::string change_address_str = | ||||
pwallet->GetChainParams()); | (options.exists("change_address") | ||||
? options["change_address"] | |||||
: options["changeAddress"]) | |||||
.get_str(); | |||||
CTxDestination dest = DecodeDestination( | |||||
change_address_str, pwallet->GetChainParams()); | |||||
if (!IsValidDestination(dest)) { | if (!IsValidDestination(dest)) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_ADDRESS_OR_KEY, | RPC_INVALID_ADDRESS_OR_KEY, | ||||
"changeAddress must be a valid bitcoin address"); | "Change address must be a valid bitcoin address"); | ||||
} | } | ||||
coinControl.destChange = dest; | coinControl.destChange = dest; | ||||
} | } | ||||
if (options.exists("changePosition")) { | if (options.exists("changePosition") || | ||||
change_position = options["changePosition"].get_int(); | options.exists("change_position")) { | ||||
change_position = (options.exists("change_position") | |||||
? options["change_position"] | |||||
: options["changePosition"]) | |||||
.get_int(); | |||||
} | } | ||||
const UniValue include_watching_option = | |||||
options.exists("include_watching") ? options["include_watching"] | |||||
: options["includeWatching"]; | |||||
coinControl.fAllowWatchOnly = | coinControl.fAllowWatchOnly = | ||||
ParseIncludeWatchonly(options["includeWatching"], *pwallet); | ParseIncludeWatchonly(include_watching_option, *pwallet); | ||||
if (options.exists("lockUnspents")) { | if (options.exists("lockUnspents") || | ||||
lockUnspents = options["lockUnspents"].get_bool(); | options.exists("lock_unspents")) { | ||||
lockUnspents = | |||||
(options.exists("lock_unspents") ? options["lock_unspents"] | |||||
: options["lockUnspents"]) | |||||
.get_bool(); | |||||
} | } | ||||
if (options.exists("feeRate")) { | if (options.exists("feeRate") || options.exists("fee_rate")) { | ||||
coinControl.m_feerate = | coinControl.m_feerate = CFeeRate(AmountFromValue( | ||||
CFeeRate(AmountFromValue(options["feeRate"])); | options.exists("fee_rate") ? options["fee_rate"] | ||||
: options["feeRate"])); | |||||
coinControl.fOverrideFeeRate = true; | coinControl.fOverrideFeeRate = true; | ||||
} | } | ||||
if (options.exists("subtractFeeFromOutputs")) { | if (options.exists("subtractFeeFromOutputs") || | ||||
options.exists("subtract_fee_from_outputs")) { | |||||
subtractFeeFromOutputs = | subtractFeeFromOutputs = | ||||
options["subtractFeeFromOutputs"].get_array(); | (options.exists("subtract_fee_from_outputs") | ||||
? options["subtract_fee_from_outputs"] | |||||
: options["subtractFeeFromOutputs"]) | |||||
.get_array(); | |||||
} | } | ||||
} | } | ||||
} else { | } else { | ||||
// if options is null and not a bool | // if options is null and not a bool | ||||
coinControl.fAllowWatchOnly = | coinControl.fAllowWatchOnly = | ||||
ParseIncludeWatchonly(NullUniValue, *pwallet); | ParseIncludeWatchonly(NullUniValue, *pwallet); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,262 Lines • Show Last 20 Lines |