2424
2525
2626namespace wallet {
27- static void ParseRecipients (const UniValue& address_amounts, const UniValue& subtract_fee_outputs, std::vector<CRecipient>& recipients )
27+ std::vector<CRecipient> CreateRecipients (const UniValue& address_amounts, const UniValue& subtract_fee_outputs)
2828{
29+ std::vector<CRecipient> recipients;
2930 std::set<CTxDestination> destinations;
3031 int i = 0 ;
3132 for (const std::string& address: address_amounts.getKeys ()) {
@@ -52,6 +53,7 @@ static void ParseRecipients(const UniValue& address_amounts, const UniValue& sub
5253 CRecipient recipient = {dest, amount, subtract_fee};
5354 recipients.push_back (recipient);
5455 }
56+ return recipients;
5557}
5658
5759static void InterpretFeeEstimationInstructions (const UniValue& conf_target, const UniValue& estimate_mode, const UniValue& fee_rate, UniValue& options)
@@ -301,8 +303,7 @@ RPCHelpMan sendtoaddress()
301303 subtractFeeFromAmount.push_back (address);
302304 }
303305
304- std::vector<CRecipient> recipients;
305- ParseRecipients (address_amounts, subtractFeeFromAmount, recipients);
306+ std::vector<CRecipient> recipients = CreateRecipients (address_amounts, subtractFeeFromAmount);
306307 const bool verbose{request.params [10 ].isNull () ? false : request.params [10 ].get_bool ()};
307308
308309 return SendMoney (*pwallet, coin_control, recipients, mapValue, verbose);
@@ -397,8 +398,7 @@ RPCHelpMan sendmany()
397398
398399 SetFeeEstimateMode (*pwallet, coin_control, /* conf_target=*/ request.params [6 ], /* estimate_mode=*/ request.params [7 ], /* fee_rate=*/ request.params [8 ], /* override_min_fee=*/ false );
399400
400- std::vector<CRecipient> recipients;
401- ParseRecipients (sendTo, subtractFeeFromAmount, recipients);
401+ std::vector<CRecipient> recipients = CreateRecipients (sendTo, subtractFeeFromAmount);
402402 const bool verbose{request.params [9 ].isNull () ? false : request.params [9 ].get_bool ()};
403403
404404 return SendMoney (*pwallet, coin_control, recipients, std::move (mapValue), verbose);
0 commit comments