@@ -807,9 +807,7 @@ static UniValue sendmany(const JSONRPCRequest& request)
807807 return NullUniValue;
808808 }
809809
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" ,
813811 " \n Send multiple times. Amounts are double-precision floating point numbers." +
814812 HelpRequiringPassphrase (pwallet) + " \n " ,
815813 {
@@ -819,7 +817,7 @@ static UniValue sendmany(const JSONRPCRequest& request)
819817 {" 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" },
820818 },
821819 },
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 " },
823821 {" comment" , RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, " A comment" },
824822 {" subtractfeefrom" , RPCArg::Type::ARR, RPCArg::Optional::OMITTED_NAMED_ARG, " A json array with addresses.\n "
825823 " The fee will be equally deducted from the amount of each selected address.\n "
@@ -850,7 +848,11 @@ static UniValue sendmany(const JSONRPCRequest& request)
850848 " \n As a JSON-RPC call\n "
851849 + HelpExampleRpc (" sendmany" , " \"\" , {\" 1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XX\" :0.01,\" 1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\" :0.02}, 6, \" testing\" " )
852850 },
853- }.ToString ());
851+ };
852+
853+ if (request.fHelp || !help.IsValidNumArgs (request.params .size ())) {
854+ throw std::runtime_error (help.ToString ());
855+ }
854856
855857 // Make sure the results are valid at least up to the most recent block
856858 // the user could have gotten from another RPC command prior to now
@@ -867,9 +869,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
867869 throw JSONRPCError (RPC_INVALID_PARAMETER, " Dummy value must be set to \"\" " );
868870 }
869871 UniValue sendTo = request.params [1 ].get_obj ();
870- int nMinDepth = 1 ;
871- if (!request.params [2 ].isNull ())
872- nMinDepth = request.params [2 ].get_int ();
873872
874873 mapValue_t mapValue;
875874 if (!request.params [3 ].isNull () && !request.params [3 ].get_str ().empty ())
@@ -897,7 +896,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
897896 std::set<CTxDestination> destinations;
898897 std::vector<CRecipient> vecSend;
899898
900- CAmount totalAmount = 0 ;
901899 std::vector<std::string> keys = sendTo.getKeys ();
902900 for (const std::string& name_ : keys) {
903901 CTxDestination dest = DecodeDestination (name_);
@@ -914,7 +912,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
914912 CAmount nAmount = AmountFromValue (sendTo[name_]);
915913 if (nAmount <= 0 )
916914 throw JSONRPCError (RPC_TYPE_ERROR, " Invalid amount for send" );
917- totalAmount += nAmount;
918915
919916 bool fSubtractFeeFromAmount = false ;
920917 for (unsigned int idx = 0 ; idx < subtractFeeFromAmount.size (); idx++) {
@@ -929,11 +926,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
929926
930927 EnsureWalletIsUnlocked (pwallet);
931928
932- // Check funds
933- if (totalAmount > pwallet->GetLegacyBalance (ISMINE_SPENDABLE, nMinDepth)) {
934- throw JSONRPCError (RPC_WALLET_INSUFFICIENT_FUNDS, " Wallet has insufficient funds" );
935- }
936-
937929 // Shuffle recipient list
938930 std::shuffle (vecSend.begin (), vecSend.end (), FastRandomContext ());
939931
0 commit comments