init batontxid
added checks for rpc
This commit is contained in:
@@ -471,6 +471,8 @@ int64_t prices_batontxid(uint256 &batontxid,CTransaction bettx,uint256 bettxid)
|
||||
int32_t height;
|
||||
int32_t retcode;
|
||||
|
||||
batontxid = bettxid; // initially set to the source bet tx
|
||||
|
||||
// iterate through batons, adding up vout1 -> addedbets
|
||||
while ((retcode = CCgetspenttxid(batontxid, vini, height, bettxid, 1)) == 0) {
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user