Prevent user from specifying conflicting parameters to fundrawtx

estimate_mode/conf_target both are overridden by feeRate, so should
not be specified together with feeRate.
This commit is contained in:
Matt Corallo 2017-07-11 20:59:46 -04:00
parent 0b019357ff
commit 99c7fc39a5

View file

@ -2795,9 +2795,15 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
coinControl.signalRbf = options["replaceable"].get_bool(); coinControl.signalRbf = options["replaceable"].get_bool();
} }
if (options.exists("conf_target")) { if (options.exists("conf_target")) {
if (options.exists("feeRate")) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both conf_target and feeRate");
}
coinControl.m_confirm_target = ParseConfirmTarget(options["conf_target"]); coinControl.m_confirm_target = ParseConfirmTarget(options["conf_target"]);
} }
if (options.exists("estimate_mode")) { if (options.exists("estimate_mode")) {
if (options.exists("feeRate")) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both estimate_mode and feeRate");
}
if (!FeeModeFromString(options["estimate_mode"].get_str(), coinControl.m_fee_mode)) { if (!FeeModeFromString(options["estimate_mode"].get_str(), coinControl.m_fee_mode)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter"); throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid estimate_mode parameter");
} }