From 1aefc8dbff7167374dfeceb3280bde387ea31e4b Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 29 Jan 2019 02:05:22 -1100 Subject: [PATCH] Default validation for sudoku --- src/cc/CCtx.cpp | 4 ++-- src/cc/cclib.cpp | 4 ++++ src/cc/sudoku.cpp | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cc/CCtx.cpp b/src/cc/CCtx.cpp index 4fe4d9673..5228703ea 100644 --- a/src/cc/CCtx.cpp +++ b/src/cc/CCtx.cpp @@ -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) { diff --git a/src/cc/cclib.cpp b/src/cc/cclib.cpp index 77b9edcf6..112fba5de 100644 --- a/src/cc/cclib.cpp +++ b/src/cc/cclib.cpp @@ -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 > txids; + if ( cp->evalcode != EVAL_FAUCET2 ) + return(sudoku_validate(cp,height,eval,tx)); numvins = tx.vin.size(); numvouts = tx.vout.size(); preventCCvins = preventCCvouts = -1; diff --git a/src/cc/sudoku.cpp b/src/cc/sudoku.cpp index d97b81b0d..ccd5a913f 100644 --- a/src/cc/sudoku.cpp +++ b/src/cc/sudoku.cpp @@ -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); +}