Default validation for sudoku

This commit is contained in:
jl777
2019-01-29 02:05:22 -11:00
parent 9de5df85e8
commit 1aefc8dbff
3 changed files with 12 additions and 3 deletions

View File

@@ -73,7 +73,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
unspendablepk = GetUnspendable(cp, unspendablepriv);
GetCCaddress(cp, unspendable, unspendablepk);
othercond = MakeCCcond1(cp->evalcode, unspendablepk);
printf("evalcode.%d (%s)\n",cp->evalcode,unspendable);
//printf("evalcode.%d (%s)\n",cp->evalcode,unspendable);
// tokens support:
// to spend from dual-eval mypk vout
@@ -177,7 +177,7 @@ printf("evalcode.%d (%s)\n",cp->evalcode,unspendable);
{
privkey = unspendablepriv;
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)
{

View File

@@ -51,6 +51,8 @@ CClib_methods[] =
};
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_generate(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];
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
if ( cp->evalcode != EVAL_FAUCET2 )
return(sudoku_validate(cp,height,eval,tx));
numvins = tx.vin.size();
numvouts = tx.vout.size();
preventCCvins = preventCCvouts = -1;

View File

@@ -522,7 +522,7 @@ UniValue sudoku_generate(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
result.push_back(Pair("amount",ValueFromAmount(amount)));
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,amount,pk));
if ( inputsum > amount + 2*txfee )
@@ -558,3 +558,8 @@ UniValue sudoku_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
return(result);
}
bool sudoku_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx)
{
return(true);
}