]> Git Repo - VerusCoin.git/commitdiff
debugging
authorMichael Toutonghi <[email protected]>
Fri, 17 May 2019 07:44:35 +0000 (00:44 -0700)
committerMichael Toutonghi <[email protected]>
Fri, 17 May 2019 07:44:35 +0000 (00:44 -0700)
src/pbaas/notarization.cpp
src/pbaas/pbaas.cpp
src/rpc/pbaasrpc.cpp

index 550f91990d670bd66c5adbb6a6400975b7c3641a..4d94f667d0b84fb322239e2fd59d19923d2d373f 100644 (file)
@@ -468,6 +468,7 @@ bool CreateEarnedNotarization(CMutableTransaction &mnewTx, vector<CInputDescript
     // if we passed no prior notarizations, the crosstxid returned can be null
     if ((!uv1.isStr() && (cnd.vtx.size() != 0)) || !uv2.isStr() || !uv3.isStr() || !uv4.isStr())
     {
+        printf("%sinvalid parameters\n", funcname);
         return false;
     }
 
@@ -478,6 +479,7 @@ bool CreateEarnedNotarization(CMutableTransaction &mnewTx, vector<CInputDescript
 
     if (crossNotarizationID.IsNull() || !DecodeHexTx(crossTx, uv3.get_str()))
     {
+        printf("%sinvalid parameters 2\n", funcname);
         return false;
     }
 
@@ -567,6 +569,7 @@ bool CreateEarnedNotarization(CMutableTransaction &mnewTx, vector<CInputDescript
     if (crossNotarizaton.prevNotarization.IsNull() && !chainDef.IsValid())
     {
         // must either have a prior notarization or be the definition
+        printf("%sNo prior notarization and no chain definition in cross notarization\n", funcname);
         return false;
     }
 
@@ -597,6 +600,7 @@ bool CreateEarnedNotarization(CMutableTransaction &mnewTx, vector<CInputDescript
         if (pbn.prevHeight + CPBaaSNotarization::MIN_BLOCKS_BETWEEN_ACCEPTED > pbn.notarizationHeight)
         {
             // can't make another notarization yet
+            printf("%sNot enough blocks to notarize - prevHeight.%d, notarizationHeight.%d\n", funcname, pbn.prevHeight, pbn.notarizationHeight);
             return false;
         }
     }
@@ -1042,8 +1046,7 @@ uint256 CreateAcceptedNotarization(const CBlock &blk, int32_t txIndex, int32_t h
         pbn.nodes.erase(pbn.nodes.begin() + toErase);
     }
 
-    //TODO: UNCOMMENT
-    //CScript opRet = StoreOpRetArray(chainObjects);
+    CScript opRet = StoreOpRetArray(chainObjects);
 
     // we are ready to create a transaction to send to the other chain
 
@@ -1064,8 +1067,7 @@ uint256 CreateAcceptedNotarization(const CBlock &blk, int32_t txIndex, int32_t h
     vKeys.push_back(CTxDestination(CKeyID(CCrossChainRPCData::GetConditionID(ASSETCHAINS_CHAINID, EVAL_ACCEPTEDNOTARIZATION))));
     mnewTx.vout.push_back(MakeCC1of1Vout(EVAL_ACCEPTEDNOTARIZATION, PBAAS_MINNOTARIZATIONOUTPUT, pk, vKeys, pbn));
 
-    // TODO: UNCOMMENT make opret output
-    //mnewTx.vout.push_back(CTxOut(0, opRet));
+    mnewTx.vout.push_back(CTxOut(0, opRet));
 
     // finish transaction by sending it to the other notary chain for completion and submission
     CTransaction notarization(mnewTx);
index ca31e9913e467f1c7cab7ae196d40da306cd8e65..ad661ca6a851ed4256cc84bf21873a84238b4f9b 100644 (file)
@@ -1003,8 +1003,8 @@ void CConnectedChains::SubmissionThread()
                     {
                         printf("SubmissionThread: testing notarization\n");
 
-                        uint256 txId = CreateAcceptedNotarization(blk, txIndex, height);
-                       // uint256 txId;
+                        //uint256 txId = CreateAcceptedNotarization(blk, txIndex, height);
+                        uint256 txId;
 
                         if (!txId.IsNull())
                         {
index 701c1d1c5840f6569bc471154038e0bb4a5211b9..6c8171b0c74657af83984f5c6d4f2c95fe228219 100644 (file)
@@ -719,7 +719,6 @@ UniValue submitacceptednotarization(const UniValue& params, bool fHelp)
     CTransaction notarization;
     CPBaaSNotarization pbn;
 
-    /*
     if (!DecodeHexTx(notarization, params[0].get_str()) || 
         notarization.vin.size() || 
         notarization.vout.size() != 2 ||
@@ -728,15 +727,6 @@ UniValue submitacceptednotarization(const UniValue& params, bool fHelp)
     {
         throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid notarization transaction");
     }
-    */
-   // debugging leniency, no op_return
-    if (!DecodeHexTx(notarization, params[0].get_str()) || 
-        notarization.vin.size() || 
-        notarization.vout.size() != 1 ||
-        !(pbn = CPBaaSNotarization(notarization)).IsValid())
-    {
-        throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid notarization transaction");
-    }
 
     // ensure we are still eligible to submit
     // finalize all transactions we can and send the notarization reward, plus all orphaned finalization outputs
@@ -759,8 +749,6 @@ UniValue submitacceptednotarization(const UniValue& params, bool fHelp)
 
         // printf("opRet: %s\n", notarization.vout[notarization.vout.size() - 1].scriptPubKey.ToString().c_str());
 
-        // TODO: uncomment
-        /*
         auto chainObjects = RetrieveOpRetArray(notarization.vout[notarization.vout.size() - 1].scriptPubKey);
 
         bool stillValid = false;
@@ -805,7 +793,6 @@ UniValue submitacceptednotarization(const UniValue& params, bool fHelp)
             printf("Notarization heights not matched with previous notarization");
             throw JSONRPCError(RPC_VERIFY_REJECTED, "Notarization heights not matched with previous notarization");
         }
-        */
 
         if (pbn.prevHeight != 0 && (pbn.prevHeight + CPBaaSNotarization::MIN_BLOCKS_BETWEEN_ACCEPTED > pbn.notarizationHeight))
         {
@@ -862,9 +849,8 @@ UniValue submitacceptednotarization(const UniValue& params, bool fHelp)
             dests = std::vector<CTxDestination>({CKeyID(CCrossChainRPCData::GetConditionID(pbn.chainID, EVAL_FINALIZENOTARIZATION))});
 
             CNotarizationFinalization nf(confirmedInput);
-            // TODO UNCOMMENT: 
-            //mnewTx.vout.insert(mnewTx.vout.begin() + (mnewTx.vout.size() - 1), MakeCC1of1Vout(EVAL_FINALIZENOTARIZATION, CPBaaSChainDefinition::DEFAULT_OUTPUT_VALUE, pk, dests, nf));
-            mnewTx.vout.insert(mnewTx.vout.begin() + 1, MakeCC1of1Vout(EVAL_FINALIZENOTARIZATION, CPBaaSChainDefinition::DEFAULT_OUTPUT_VALUE, pk, dests, nf));
+
+            mnewTx.vout.insert(mnewTx.vout.begin() + (mnewTx.vout.size() - 1), MakeCC1of1Vout(EVAL_FINALIZENOTARIZATION, CPBaaSChainDefinition::DEFAULT_OUTPUT_VALUE, pk, dests, nf));
         }
 
         if (notarizationInputs.size() && GetNotarizationAndFinalization(EVAL_ACCEPTEDNOTARIZATION, mnewTx, dummy, &notarizationIdx, &finalizationIdx))
This page took 0.039729 seconds and 4 git commands to generate.