Merge branch 'jl777' into FSM

This commit is contained in:
jl777
2018-09-05 05:30:59 -11:00
2 changed files with 73 additions and 37 deletions

View File

@@ -5219,6 +5219,11 @@ UniValue rewardscreatefunding(const UniValue& params, bool fHelp)
name = (char *)params[0].get_str().c_str();
funds = atof(params[1].get_str().c_str()) * COIN;
if (!VALID_PLAN_NAME(name)) {
ERR_RESULT(strprintf("Plan name can be at most %d ASCII characters",PLAN_NAME_MAX));
return(result);
}
if ( funds <= 0 ) {
ERR_RESULT("funds must be positive");
return result;
@@ -5280,6 +5285,11 @@ UniValue rewardslock(const UniValue& params, bool fHelp)
fundingtxid = Parseuint256((char *)params[1].get_str().c_str());
amount = atof(params[2].get_str().c_str()) * COIN;
hex = RewardsLock(0,name,fundingtxid,amount);
if (!VALID_PLAN_NAME(name)) {
ERR_RESULT(strprintf("Plan name can be at most %d ASCII characters",PLAN_NAME_MAX));
return(result);
}
if ( CCerror != "" ){
ERR_RESULT(CCerror);
} else if ( amount > 0 ) {
@@ -5305,6 +5315,11 @@ UniValue rewardsaddfunding(const UniValue& params, bool fHelp)
fundingtxid = Parseuint256((char *)params[1].get_str().c_str());
amount = atof(params[2].get_str().c_str()) * COIN;
hex = RewardsAddfunding(0,name,fundingtxid,amount);
if (!VALID_PLAN_NAME(name)) {
ERR_RESULT(strprintf("Plan name can be at most %d ASCII characters",PLAN_NAME_MAX));
return(result);
}
if (CCerror != "") {
ERR_RESULT(CCerror);
} else if (amount > 0) {
@@ -5333,6 +5348,11 @@ UniValue rewardsunlock(const UniValue& params, bool fHelp)
LOCK2(cs_main, pwalletMain->cs_wallet);
name = (char *)params[0].get_str().c_str();
fundingtxid = Parseuint256((char *)params[1].get_str().c_str());
if (!VALID_PLAN_NAME(name)) {
ERR_RESULT(strprintf("Plan name can be at most %d ASCII characters",PLAN_NAME_MAX));
return(result);
}
if ( params.size() > 2 )
txid = Parseuint256((char *)params[2].get_str().c_str());
else memset(&txid,0,sizeof(txid));