mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
rpc: decouple sendtoaddress 'subtractfeefromamount' boolean parsing
The 'subtractfeefromamount' arg is only boolean for sendtoaddress(). Other commands should never provide it as a boolean.
This commit is contained in:
parent
a5fa90706a
commit
4f4cd35319
1 changed files with 8 additions and 8 deletions
|
@ -68,10 +68,7 @@ std::set<int> InterpretSubtractFeeFromOutputInstructions(const UniValue& sffo_in
|
||||||
{
|
{
|
||||||
std::set<int> sffo_set;
|
std::set<int> sffo_set;
|
||||||
if (sffo_instructions.isNull()) return sffo_set;
|
if (sffo_instructions.isNull()) return sffo_set;
|
||||||
if (sffo_instructions.isBool()) {
|
|
||||||
if (sffo_instructions.get_bool()) sffo_set.insert(0);
|
|
||||||
return sffo_set;
|
|
||||||
}
|
|
||||||
for (const auto& sffo : sffo_instructions.getValues()) {
|
for (const auto& sffo : sffo_instructions.getValues()) {
|
||||||
if (sffo.isStr()) {
|
if (sffo.isStr()) {
|
||||||
for (size_t i = 0; i < destinations.size(); ++i) {
|
for (size_t i = 0; i < destinations.size(); ++i) {
|
||||||
|
@ -310,10 +307,13 @@ RPCHelpMan sendtoaddress()
|
||||||
UniValue address_amounts(UniValue::VOBJ);
|
UniValue address_amounts(UniValue::VOBJ);
|
||||||
const std::string address = request.params[0].get_str();
|
const std::string address = request.params[0].get_str();
|
||||||
address_amounts.pushKV(address, request.params[1]);
|
address_amounts.pushKV(address, request.params[1]);
|
||||||
std::vector<CRecipient> recipients = CreateRecipients(
|
|
||||||
ParseOutputs(address_amounts),
|
std::set<int> sffo_set;
|
||||||
InterpretSubtractFeeFromOutputInstructions(request.params[4], address_amounts.getKeys())
|
if (!request.params[4].isNull() && request.params[4].get_bool()) {
|
||||||
);
|
sffo_set.insert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<CRecipient> recipients{CreateRecipients(ParseOutputs(address_amounts), sffo_set)};
|
||||||
const bool verbose{request.params[10].isNull() ? false : request.params[10].get_bool()};
|
const bool verbose{request.params[10].isNull() ? false : request.params[10].get_bool()};
|
||||||
|
|
||||||
return SendMoney(*pwallet, coin_control, recipients, mapValue, verbose);
|
return SendMoney(*pwallet, coin_control, recipients, mapValue, verbose);
|
||||||
|
|
Loading…
Add table
Reference in a new issue