added dust check
This commit is contained in:
@@ -38,9 +38,10 @@ extern CScript KOMODO_EARLYTXID_SCRIPTPUB;
|
||||
#define PRICES_MMM (KOMODO_MAXPRICES * 7) // 0011 1000 0000 0000
|
||||
#define PRICES_DDD (KOMODO_MAXPRICES * 8) // 0100 0000 0000 0000
|
||||
|
||||
#define PRICES_NORMFACTOR (int64_t)(SATOSHIDEN)
|
||||
#define PRICES_POINTFACTOR (int64_t)10000
|
||||
//#define PRICES_NORMFACTOR (int64_t)(SATOSHIDEN)
|
||||
//#define PRICES_POINTFACTOR (int64_t)10000
|
||||
|
||||
#define PRICES_REVSHAREDUST 10000
|
||||
#define PRICES_SUBREVSHAREFEE(amount) ((amount) * 199 / 200)
|
||||
|
||||
bool PricesValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx, uint32_t nIn);
|
||||
|
||||
@@ -1451,6 +1451,14 @@ UniValue PricesBet(int64_t txfee, int64_t amount, int16_t leverage, std::vector<
|
||||
if (AddNormalinputs(mtx, mypk, amount + 4 * txfee, 64) >= amount + 4 * txfee)
|
||||
{
|
||||
betamount = PRICES_SUBREVSHAREFEE(amount);
|
||||
|
||||
if( amount - betamount < PRICES_REVSHAREDUST) {
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "bet amount too small"));
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode, txfee, mypk)); // vout0 baton for total funding
|
||||
// mtx.vout.push_back(MakeCC1vout(cp->evalcode, (amount - betamount) + 2 * txfee, pricespk)); // vout1, when spent, costbasis is set
|
||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode, txfee, pricespk)); // vout1 cc marker (NVOUT_CCMARKER)
|
||||
@@ -1514,6 +1522,11 @@ UniValue PricesAddFunding(int64_t txfee, uint256 bettxid, int64_t amount)
|
||||
if (AddNormalinputs(mtx, mypk, amount + 2*txfee, 64) >= amount + 2*txfee)
|
||||
{
|
||||
betamount = PRICES_SUBREVSHAREFEE(amount);
|
||||
if (amount - betamount < PRICES_REVSHAREDUST) {
|
||||
result.push_back(Pair("result", "error"));
|
||||
result.push_back(Pair("error", "bet amount too small"));
|
||||
return(result);
|
||||
}
|
||||
|
||||
std::vector<OneBetData> bets;
|
||||
if (prices_enumaddedbets(batontxid, bets, bettxid) >= 0)
|
||||
|
||||
Reference in New Issue
Block a user