]> Git Repo - VerusCoin.git/blobdiff - src/cc/eval.cpp
Support for identities, identity APIs and new signing model - breaking change with...
[VerusCoin.git] / src / cc / eval.cpp
index 949728be4bfe30453e6a452ddd1601a53652dd3b..cc7b230ca1ab3d8f5955e2721f2a7c0bcefde87d 100644 (file)
@@ -38,7 +38,7 @@ bool RunCCEval(const CC *cond, const CTransaction &tx, unsigned int nIn)
     pthread_mutex_lock(&KOMODO_CC_mutex);
     bool out = eval->Dispatch(cond, tx, nIn);
     pthread_mutex_unlock(&KOMODO_CC_mutex);
-    fprintf(stderr,"out %d vs %d isValid\n",(int32_t)out,(int32_t)eval->state.IsValid());
+    //fprintf(stderr,"out %d vs %d isValid\n",(int32_t)out,(int32_t)eval->state.IsValid());
     assert(eval->state.IsValid() == out);
 
     if (eval->state.IsValid()) return true;
@@ -73,16 +73,39 @@ bool Eval::Dispatch(const CC *cond, const CTransaction &txTo, unsigned int nIn)
     std::vector<uint8_t> vparams(cond->code+1, cond->code+cond->codeLength);
     switch ( ecode )
     {
+        case EVAL_PBAASDEFINITION:
+        case EVAL_SERVICEREWARD:
+        case EVAL_EARNEDNOTARIZATION:
+        case EVAL_ACCEPTEDNOTARIZATION:
+        case EVAL_FINALIZENOTARIZATION:
+        case EVAL_RESERVE_OUTPUT:
+        case EVAL_RESERVE_EXCHANGE:
+        case EVAL_RESERVE_TRANSFER:
+        case EVAL_RESERVE_DEPOSIT:
+        case EVAL_CROSSCHAIN_EXPORT:
+        case EVAL_CROSSCHAIN_IMPORT:
+        case EVAL_CURRENCYSTATE:
+        //case EVAL_IDENTITY_PRIMARY:
+        //case EVAL_IDENTITY_REVOKE:
+        //case EVAL_IDENTITY_RECOVER:
+        //case EVAL_IDENTITY_COMMITMENT:
+        //case EVAL_IDENTITY_RESERVATION:
+            if (!chainActive.LastTip() || CConstVerusSolutionVector::activationHeight.ActiveVersion(chainActive.LastTip()->GetHeight() + 1) < CActivationHeight::SOLUTION_VERUSV3)
+            {
+                // if chain is not able to process this yet, don't drop through to do so
+                break;
+            }
+
+        case EVAL_STAKEGUARD:
+            return(ProcessCC(cp,this, vparams, txTo, nIn));
+            break;
+
         case EVAL_IMPORTPAYOUT:
-            return ImportPayout(vparams, txTo, nIn);
+            //return ImportPayout(vparams, txTo, nIn);
             break;
             
         case EVAL_IMPORTCOIN:
-            return ImportCoin(vparams, txTo, nIn);
-            break;
-            
-        default:
-            return(ProcessCC(cp,this, vparams, txTo, nIn));
+            //return ImportCoin(vparams, txTo, nIn);
             break;
     }
     return Invalid("invalid-code, dont forget to add EVAL_NEWCC to Eval::Dispatch");
@@ -158,7 +181,8 @@ bool Eval::CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t t
         if (tx.vout.size() < txIn.prevout.n) return false;
         CScript spk = tx.vout[txIn.prevout.n].scriptPubKey;
         if (spk.size() != 35) return false;
-        const unsigned char *pk = spk.data();
+        std::vector<unsigned char> scriptVec = std::vector<unsigned char>(spk.begin(),spk.end());
+        const unsigned char *pk = scriptVec.data();
         if (pk++[0] != 33) return false;
         if (pk[33] != OP_CHECKSIG) return false;
 
@@ -187,7 +211,7 @@ bool Eval::GetNotarisationData(const uint256 notaryHash, NotarisationData &data)
     CTransaction notarisationTx;
     CBlockIndex block;
     if (!GetTxConfirmed(notaryHash, notarisationTx, block)) return false;
-    if (!CheckNotaryInputs(notarisationTx, block.nHeight, block.nTime)) return false;
+    if (!CheckNotaryInputs(notarisationTx, block.GetHeight(), block.nTime)) return false;
     if (!ParseNotarisationOpReturn(notarisationTx, data)) return false;
     return true;
 }
This page took 0.025214 seconds and 4 git commands to generate.