|
21 | 21 |
|
22 | 22 |
|
23 | 23 | namespace wallet {
|
24 |
| -static void ParseRecipients(const UniValue& address_amounts, const UniValue& subtract_fee_outputs, std::vector<CRecipient> &recipients) { |
| 24 | +static void ParseRecipients(const UniValue& address_amounts, const UniValue& subtract_fee_outputs, std::vector<CRecipient> &recipients) |
| 25 | +{ |
25 | 26 | std::set<CTxDestination> destinations;
|
26 | 27 | int i = 0;
|
27 | 28 | for (const std::string& address: address_amounts.getKeys()) {
|
@@ -51,6 +52,28 @@ static void ParseRecipients(const UniValue& address_amounts, const UniValue& sub
|
51 | 52 | }
|
52 | 53 | }
|
53 | 54 |
|
| 55 | +static void PreventOutdatedOptions(const UniValue& options) |
| 56 | +{ |
| 57 | + if (options.exists("feeRate")) { |
| 58 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Use fee_rate (" + CURRENCY_ATOM + "/vB) instead of feeRate"); |
| 59 | + } |
| 60 | + if (options.exists("changeAddress")) { |
| 61 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Use change_address"); |
| 62 | + } |
| 63 | + if (options.exists("changePosition")) { |
| 64 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Use change_position"); |
| 65 | + } |
| 66 | + if (options.exists("includeWatching")) { |
| 67 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Use include_watching"); |
| 68 | + } |
| 69 | + if (options.exists("lockUnspents")) { |
| 70 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Use lock_unspents"); |
| 71 | + } |
| 72 | + if (options.exists("subtractFeeFromOutputs")) { |
| 73 | + throw JSONRPCError(RPC_INVALID_PARAMETER, "Use subtract_fee_from_outputs"); |
| 74 | + } |
| 75 | +} |
| 76 | + |
54 | 77 | UniValue SendMoney(CWallet& wallet, const CCoinControl &coin_control, std::vector<CRecipient> &recipients, mapValue_t map_value, bool verbose)
|
55 | 78 | {
|
56 | 79 | EnsureWalletIsUnlocked(wallet);
|
@@ -1144,24 +1167,7 @@ RPCHelpMan send()
|
1144 | 1167 | if (!options["conf_target"].isNull() && (options["estimate_mode"].isNull() || (options["estimate_mode"].get_str() == "unset"))) {
|
1145 | 1168 | throw JSONRPCError(RPC_INVALID_PARAMETER, "Specify estimate_mode");
|
1146 | 1169 | }
|
1147 |
| - if (options.exists("feeRate")) { |
1148 |
| - throw JSONRPCError(RPC_INVALID_PARAMETER, "Use fee_rate (" + CURRENCY_ATOM + "/vB) instead of feeRate"); |
1149 |
| - } |
1150 |
| - if (options.exists("changeAddress")) { |
1151 |
| - throw JSONRPCError(RPC_INVALID_PARAMETER, "Use change_address"); |
1152 |
| - } |
1153 |
| - if (options.exists("changePosition")) { |
1154 |
| - throw JSONRPCError(RPC_INVALID_PARAMETER, "Use change_position"); |
1155 |
| - } |
1156 |
| - if (options.exists("includeWatching")) { |
1157 |
| - throw JSONRPCError(RPC_INVALID_PARAMETER, "Use include_watching"); |
1158 |
| - } |
1159 |
| - if (options.exists("lockUnspents")) { |
1160 |
| - throw JSONRPCError(RPC_INVALID_PARAMETER, "Use lock_unspents"); |
1161 |
| - } |
1162 |
| - if (options.exists("subtractFeeFromOutputs")) { |
1163 |
| - throw JSONRPCError(RPC_INVALID_PARAMETER, "Use subtract_fee_from_outputs"); |
1164 |
| - } |
| 1170 | + PreventOutdatedOptions(options); |
1165 | 1171 |
|
1166 | 1172 | const bool psbt_opt_in = options.exists("psbt") && options["psbt"].get_bool();
|
1167 | 1173 |
|
|
0 commit comments