diff --git a/src/cc/prices.cpp b/src/cc/prices.cpp index e6f5db97d..28bfaf848 100644 --- a/src/cc/prices.cpp +++ b/src/cc/prices.cpp @@ -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) { diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index aad8c4c6c..550355cff 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -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); }