init batontxid

added checks for rpc
This commit is contained in:
dimxy
2019-04-15 22:15:12 +05:00
parent 5c349ea415
commit 505619e202
2 changed files with 9 additions and 1 deletions

View File

@@ -1348,7 +1348,8 @@ UniValue pricesbet(const UniValue& params, bool fHelp)
UniValue pricesaddfunding(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 2)
throw runtime_error("pricesaddfunding bettxid amount\n");
throw runtime_error("pricesaddfunding bettxid amount\n"
"where amount is in satoshis\n");
LOCK(cs_main);
UniValue ret(UniValue::VOBJ);
@@ -1357,7 +1358,12 @@ UniValue pricesaddfunding(const UniValue& params, bool fHelp)
CAmount txfee = 10000;
uint256 bettxid = Parseuint256(params[0].get_str().c_str());
if( bettxid.IsNull() )
throw runtime_error("invalid bettxid\n");
CAmount amount = atoll(params[1].get_str().c_str());
if( amount <= 0 )
throw runtime_error("invalid amount\n");
return PricesAddFunding(txfee, bettxid, amount);
}