@@ -55,32 +55,33 @@ void checkBudgetInputs(const UniValue& params, std::string &strProposalName, std
5555 CBlockIndex* pindexPrev = chainActive.Tip ();
5656
5757 if (strProposalName.size () > 20 )
58- throw std::runtime_error ( " Invalid proposal name, limit of 20 characters." );
58+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid proposal name, limit of 20 characters." );
5959
6060 strURL = SanitizeString (params[1 ].get_str ());
61- if (strURL.size () > 64 )
62- throw std::runtime_error (" Invalid url, limit of 64 characters." );
61+ std::string strErr;
62+ if (!validateURL (strURL, strErr))
63+ throw JSONRPCError (RPC_INVALID_PARAMETER, result);
6364
6465 nPaymentCount = params[2 ].get_int ();
6566 if (nPaymentCount < 1 )
66- throw std::runtime_error ( " Invalid payment count, must be more than zero." );
67+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid payment count, must be more than zero." );
6768
6869 // Start must be in the next budget cycle
6970 if (pindexPrev != NULL ) nBlockMin = pindexPrev->nHeight - pindexPrev->nHeight % Params ().GetBudgetCycleBlocks () + Params ().GetBudgetCycleBlocks ();
7071
7172 nBlockStart = params[3 ].get_int ();
7273 if (nBlockStart % Params ().GetBudgetCycleBlocks () != 0 ) {
7374 int nNext = pindexPrev->nHeight - pindexPrev->nHeight % Params ().GetBudgetCycleBlocks () + Params ().GetBudgetCycleBlocks ();
74- throw std::runtime_error ( strprintf (" Invalid block start - must be a budget cycle block. Next valid block: %d" , nNext));
75+ throw JSONRPCError (RPC_INVALID_PARAMETER, strprintf (" Invalid block start - must be a budget cycle block. Next valid block: %d" , nNext));
7576 }
7677
7778 int nBlockEnd = nBlockStart + (Params ().GetBudgetCycleBlocks () * nPaymentCount); // End must be AFTER current cycle
7879
7980 if (nBlockStart < nBlockMin)
80- throw std::runtime_error ( " Invalid block start, must be more than current height." );
81+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid block start, must be more than current height." );
8182
8283 if (nBlockEnd < pindexPrev->nHeight )
83- throw std::runtime_error ( " Invalid ending block, starting block + (payment_cycle*payments) must be more than current height." );
84+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid ending block, starting block + (payment_cycle*payments) must be more than current height." );
8485
8586 address = params[4 ].get_str ();
8687 if (!address.IsValid ())
0 commit comments