@@ -807,9 +807,7 @@ static UniValue sendmany(const JSONRPCRequest& request)
807
807
return NullUniValue;
808
808
}
809
809
810
- if (request.fHelp || request.params .size () < 2 || request.params .size () > 8 )
811
- throw std::runtime_error (
812
- RPCHelpMan{" sendmany" ,
810
+ const RPCHelpMan help{" sendmany" ,
813
811
" \n Send multiple times. Amounts are double-precision floating point numbers." +
814
812
HelpRequiringPassphrase (pwallet) + " \n " ,
815
813
{
@@ -819,7 +817,7 @@ static UniValue sendmany(const JSONRPCRequest& request)
819
817
{" address" , RPCArg::Type::AMOUNT, RPCArg::Optional::NO, " The bitcoin address is the key, the numeric amount (can be string) in " + CURRENCY_UNIT + " is the value" },
820
818
},
821
819
},
822
- {" minconf" , RPCArg::Type::NUM, /* default */ " 1 " , " Only use the balance confirmed at least this many times. " },
820
+ {" minconf" , RPCArg::Type::NUM, RPCArg::Optional::OMITTED_NAMED_ARG , " Ignored dummy value " },
823
821
{" comment" , RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, " A comment" },
824
822
{" subtractfeefrom" , RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, " A json array with addresses.\n "
825
823
" The fee will be equally deducted from the amount of each selected address.\n "
@@ -850,7 +848,11 @@ static UniValue sendmany(const JSONRPCRequest& request)
850
848
" \n As a JSON-RPC call\n "
851
849
+ HelpExampleRpc (" sendmany" , " \"\" , {\" 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" :0.01,\" 1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\" :0.02}, 6, \" testing\" " )
852
850
},
853
- }.ToString ());
851
+ };
852
+
853
+ if (request.fHelp || !help.IsValidNumArgs (request.params .size ())) {
854
+ throw std::runtime_error (help.ToString ());
855
+ }
854
856
855
857
// Make sure the results are valid at least up to the most recent block
856
858
// the user could have gotten from another RPC command prior to now
@@ -867,9 +869,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
867
869
throw JSONRPCError (RPC_INVALID_PARAMETER, " Dummy value must be set to \"\" " );
868
870
}
869
871
UniValue sendTo = request.params [1 ].get_obj ();
870
- int nMinDepth = 1 ;
871
- if (!request.params [2 ].isNull ())
872
- nMinDepth = request.params [2 ].get_int ();
873
872
874
873
mapValue_t mapValue;
875
874
if (!request.params [3 ].isNull () && !request.params [3 ].get_str ().empty ())
@@ -897,7 +896,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
897
896
std::set<CTxDestination> destinations;
898
897
std::vector<CRecipient> vecSend;
899
898
900
- CAmount totalAmount = 0 ;
901
899
std::vector<std::string> keys = sendTo.getKeys ();
902
900
for (const std::string& name_ : keys) {
903
901
CTxDestination dest = DecodeDestination (name_);
@@ -914,7 +912,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
914
912
CAmount nAmount = AmountFromValue (sendTo[name_]);
915
913
if (nAmount <= 0 )
916
914
throw JSONRPCError (RPC_TYPE_ERROR, " Invalid amount for send" );
917
- totalAmount += nAmount;
918
915
919
916
bool fSubtractFeeFromAmount = false ;
920
917
for (unsigned int idx = 0 ; idx < subtractFeeFromAmount.size (); idx++) {
@@ -929,11 +926,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
929
926
930
927
EnsureWalletIsUnlocked (pwallet);
931
928
932
- // Check funds
933
- if (totalAmount > pwallet->GetLegacyBalance (ISMINE_SPENDABLE, nMinDepth)) {
934
- throw JSONRPCError (RPC_WALLET_INSUFFICIENT_FUNDS, " Wallet has insufficient funds" );
935
- }
936
-
937
929
// Shuffle recipient list
938
930
std::shuffle (vecSend.begin (), vecSend.end (), FastRandomContext ());
939
931
0 commit comments