diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3695,12 +3695,18 @@ { {"add_inputs", UniValueType(UniValue::VBOOL)}, {"changeAddress", UniValueType(UniValue::VSTR)}, + {"change_address", UniValueType(UniValue::VSTR)}, {"changePosition", UniValueType(UniValue::VNUM)}, + {"change_position", UniValueType(UniValue::VNUM)}, {"includeWatching", UniValueType(UniValue::VBOOL)}, + {"include_watching", UniValueType(UniValue::VBOOL)}, {"lockUnspents", UniValueType(UniValue::VBOOL)}, + {"lock_unspents", UniValueType(UniValue::VBOOL)}, // will be checked below {"feeRate", UniValueType()}, + {"fee_rate", UniValueType()}, {"subtractFeeFromOutputs", UniValueType(UniValue::VARR)}, + {"subtract_fee_from_outputs", UniValueType(UniValue::VARR)}, }, true, true); @@ -3708,40 +3714,61 @@ coinControl.m_add_inputs = options["add_inputs"].get_bool(); } - if (options.exists("changeAddress")) { - CTxDestination dest = - DecodeDestination(options["changeAddress"].get_str(), - pwallet->GetChainParams()); + if (options.exists("changeAddress") || + options.exists("change_address")) { + const std::string change_address_str = + (options.exists("change_address") + ? options["change_address"] + : options["changeAddress"]) + .get_str(); + CTxDestination dest = DecodeDestination( + change_address_str, pwallet->GetChainParams()); if (!IsValidDestination(dest)) { throw JSONRPCError( RPC_INVALID_ADDRESS_OR_KEY, - "changeAddress must be a valid bitcoin address"); + "Change address must be a valid bitcoin address"); } coinControl.destChange = dest; } - if (options.exists("changePosition")) { - change_position = options["changePosition"].get_int(); + if (options.exists("changePosition") || + 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 = - ParseIncludeWatchonly(options["includeWatching"], *pwallet); - - if (options.exists("lockUnspents")) { - lockUnspents = options["lockUnspents"].get_bool(); + ParseIncludeWatchonly(include_watching_option, *pwallet); + + if (options.exists("lockUnspents") || + options.exists("lock_unspents")) { + lockUnspents = + (options.exists("lock_unspents") ? options["lock_unspents"] + : options["lockUnspents"]) + .get_bool(); } - if (options.exists("feeRate")) { - coinControl.m_feerate = - CFeeRate(AmountFromValue(options["feeRate"])); + if (options.exists("feeRate") || options.exists("fee_rate")) { + coinControl.m_feerate = CFeeRate(AmountFromValue( + options.exists("fee_rate") ? options["fee_rate"] + : options["feeRate"])); coinControl.fOverrideFeeRate = true; } - if (options.exists("subtractFeeFromOutputs")) { + if (options.exists("subtractFeeFromOutputs") || + options.exists("subtract_fee_from_outputs")) { subtractFeeFromOutputs = - options["subtractFeeFromOutputs"].get_array(); + (options.exists("subtract_fee_from_outputs") + ? options["subtract_fee_from_outputs"] + : options["subtractFeeFromOutputs"]) + .get_array(); } } } else { diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -246,7 +246,7 @@ assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) assert_raises_rpc_error( - -5, "changeAddress must be a valid bitcoin address", + -5, "Change address must be a valid bitcoin address", self.nodes[2].fundrawtransaction, rawTx, {'changeAddress': 'foobar'}) def test_valid_change_address(self):