Default validation for sudoku
This commit is contained in:
@@ -73,7 +73,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
|||||||
unspendablepk = GetUnspendable(cp, unspendablepriv);
|
unspendablepk = GetUnspendable(cp, unspendablepriv);
|
||||||
GetCCaddress(cp, unspendable, unspendablepk);
|
GetCCaddress(cp, unspendable, unspendablepk);
|
||||||
othercond = MakeCCcond1(cp->evalcode, unspendablepk);
|
othercond = MakeCCcond1(cp->evalcode, unspendablepk);
|
||||||
printf("evalcode.%d (%s)\n",cp->evalcode,unspendable);
|
//printf("evalcode.%d (%s)\n",cp->evalcode,unspendable);
|
||||||
// tokens support:
|
// tokens support:
|
||||||
|
|
||||||
// to spend from dual-eval mypk vout
|
// to spend from dual-eval mypk vout
|
||||||
@@ -177,7 +177,7 @@ printf("evalcode.%d (%s)\n",cp->evalcode,unspendable);
|
|||||||
{
|
{
|
||||||
privkey = unspendablepriv;
|
privkey = unspendablepriv;
|
||||||
cond = othercond;
|
cond = othercond;
|
||||||
fprintf(stderr,"FinalizeCCTx(%d) matched unspendable CC addr.(%s)\n",cp->evalcode,unspendable);
|
//fprintf(stderr,"FinalizeCCTx(%d) matched unspendable CC addr.(%s)\n",cp->evalcode,unspendable);
|
||||||
}
|
}
|
||||||
else if (strcmp(destaddr, tokensunspendable) == 0)
|
else if (strcmp(destaddr, tokensunspendable) == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ CClib_methods[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *params);
|
std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *params);
|
||||||
|
|
||||||
|
bool sudoku_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx);
|
||||||
UniValue sudoku_txidinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
UniValue sudoku_txidinfo(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
||||||
UniValue sudoku_generate(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
UniValue sudoku_generate(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
||||||
UniValue sudoku_solution(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
UniValue sudoku_solution(uint64_t txfee,struct CCcontract_info *cp,cJSON *params);
|
||||||
@@ -190,6 +192,8 @@ bool CClib_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
|
|||||||
{
|
{
|
||||||
int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,numblocks; bool retval; uint256 txid; uint8_t hash[32]; char str[65],destaddr[64];
|
int32_t numvins,numvouts,preventCCvins,preventCCvouts,i,numblocks; bool retval; uint256 txid; uint8_t hash[32]; char str[65],destaddr[64];
|
||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
|
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
|
||||||
|
if ( cp->evalcode != EVAL_FAUCET2 )
|
||||||
|
return(sudoku_validate(cp,height,eval,tx));
|
||||||
numvins = tx.vin.size();
|
numvins = tx.vin.size();
|
||||||
numvouts = tx.vout.size();
|
numvouts = tx.vout.size();
|
||||||
preventCCvins = preventCCvouts = -1;
|
preventCCvins = preventCCvouts = -1;
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ UniValue sudoku_generate(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
|||||||
result.push_back(Pair("amount",ValueFromAmount(amount)));
|
result.push_back(Pair("amount",ValueFromAmount(amount)));
|
||||||
if ( (inputsum= AddCClibInputs(cp,mtx,sudokupk,amount+2*txfee,16)) >= amount+2*txfee )
|
if ( (inputsum= AddCClibInputs(cp,mtx,sudokupk,amount+2*txfee,16)) >= amount+2*txfee )
|
||||||
{
|
{
|
||||||
printf("inputsum %.8f\n",(double)inputsum/COIN);
|
//printf("inputsum %.8f\n",(double)inputsum/COIN);
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,sudokupk));
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,sudokupk));
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,amount,pk));
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,amount,pk));
|
||||||
if ( inputsum > amount + 2*txfee )
|
if ( inputsum > amount + 2*txfee )
|
||||||
@@ -558,3 +558,8 @@ UniValue sudoku_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool sudoku_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx)
|
||||||
|
{
|
||||||
|
return(true);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user