]> Git Repo - VerusCoin.git/commitdiff
Merkle tree building for pre-fork and API updates
authormiketout <[email protected]>
Tue, 12 Nov 2019 20:03:28 +0000 (12:03 -0800)
committermiketout <[email protected]>
Tue, 12 Nov 2019 20:03:28 +0000 (12:03 -0800)
src/init.cpp
src/miner.cpp
src/rpc/pbaasrpc.cpp

index a8fa4ddcce5f4ae86da246281c91bd683d08b677..6eea7690221f52dd39b075f46f1ab04751b44a5c 100644 (file)
@@ -1216,11 +1216,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
         if (strcmp(ASSETCHAINS_SYMBOL,"VRSC") == 0)
         {
             CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV2, 310000);
+            CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV3, 782000);
         }
         else
         {
             CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV2, 1);
-            CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV3, 1);
+            CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV3, 700);
+            //CConstVerusSolutionVector::activationHeight.SetActivationHeight(CActivationHeight::SOLUTION_VERUSV4, 1);
         }
     }
 
index a0fbaa24609899f9499346630fd4b9daf0c49422..f2a5465c1842483a21ed4a043c695c9fd0618594 100644 (file)
@@ -2024,7 +2024,7 @@ static bool ProcessBlockFound(CBlock* pblock)
 #endif
     //fprintf(stderr,"process new block\n");
 
-    // Process this block the same as if we had received it from another node
+    // Process this block (almost) the same as if we had received it from another node
     CValidationState state;
     if (!ProcessNewBlock(1, chainActive.LastTip()->GetHeight()+1, state, Params(), NULL, pblock, true, NULL))
         return error("VerusMiner: ProcessNewBlock, block not accepted");
@@ -2430,7 +2430,7 @@ void static BitcoinMiner_noeq()
             savebits = pblock->nBits;
 
             bool verusHashV2 = pblock->nVersion == CBlockHeader::VERUS_V2;
-            bool verusSolutionV3 = CConstVerusSolutionVector::Version(pblock->nSolution) == CActivationHeight::SOLUTION_VERUSV3;
+            bool verusSolutionV3 = CConstVerusSolutionVector::Version(pblock->nSolution) >= CActivationHeight::SOLUTION_VERUSV3;
 
             if ( ASSETCHAINS_SYMBOL[0] != 0 )
             {
@@ -2447,8 +2447,8 @@ void static BitcoinMiner_noeq()
                 }
             }
 
-            // this builds the Merkle tree and sets our easiest target
-            IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, false, &savebits);
+            // set our easiest target, if V3+, no need to rebuild the merkle tree
+            IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, verusSolutionV3 ? false : true, &savebits);
 
             // update PBaaS header
             if (verusSolutionV3)
@@ -2610,7 +2610,7 @@ void static BitcoinMiner_noeq()
                             // pickup/remove any new/deleted headers
                             if (ConnectedChains.dirty || (pblock->NumPBaaSHeaders() < ConnectedChains.mergeMinedChains.size() + 1))
                             {
-                                IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, false, &savebits);
+                                IncrementExtraNonce(pblock, pindexPrev, nExtraNonce, verusSolutionV3 ? false : true, &savebits);
 
                                 hashTarget.SetCompact(savebits);
                                 uintTarget = ArithToUint256(hashTarget);
index c5b5e1d808469271d1576b59504495d5d27e292b..2aece2f4840a9305782beec163b414c7a2f81056 100644 (file)
@@ -541,7 +541,7 @@ bool CConnectedChains::CreateLatestImports(const CPBaaSChainDefinition &chainDef
 void CheckPBaaSAPIsValid()
 {
     if (!chainActive.LastTip() ||
-        CConstVerusSolutionVector::activationHeight.ActiveVersion(chainActive.LastTip()->GetHeight()) >= CConstVerusSolutionVector::activationHeight.SOLUTION_VERUSV4)
+        CConstVerusSolutionVector::activationHeight.ActiveVersion(chainActive.LastTip()->GetHeight()) < CConstVerusSolutionVector::activationHeight.SOLUTION_VERUSV4)
     {
         throw JSONRPCError(RPC_INVALID_REQUEST, "PBaaS not activated on blockchain.");
     }
@@ -550,9 +550,9 @@ void CheckPBaaSAPIsValid()
 void CheckIdentityAPIsValid()
 {
     if (!chainActive.LastTip() ||
-        CConstVerusSolutionVector::activationHeight.ActiveVersion(chainActive.LastTip()->GetHeight()) >= CConstVerusSolutionVector::activationHeight.SOLUTION_VERUSV3)
+        CConstVerusSolutionVector::activationHeight.ActiveVersion(chainActive.LastTip()->GetHeight()) < CConstVerusSolutionVector::activationHeight.SOLUTION_VERUSV3)
     {
-        throw JSONRPCError(RPC_INVALID_REQUEST, "PBaaS not activated on blockchain.");
+        throw JSONRPCError(RPC_INVALID_REQUEST, "Identity APIs not activated on blockchain.");
     }
 }
 
@@ -4175,7 +4175,7 @@ UniValue registernamecommitment(const UniValue& params, bool fHelp)
         );
     }
 
-    CheckPBaaSAPIsValid();
+    CheckIdentityAPIsValid();
 
     uint160 parent = IsVerusActive() ? uint160() : ConnectedChains.ThisChain().GetChainID();
     std::string name = CIdentity::CleanName(uni_get_str(params[0]), parent);
@@ -4275,7 +4275,7 @@ UniValue registeridentity(const UniValue& params, bool fHelp)
         );
     }
 
-    CheckPBaaSAPIsValid();
+    CheckIdentityAPIsValid();
 
     // all names have a parent of the current chain, except if defined on the Verus chain, which has a parent of null
     uint160 parent = IsVerusActive() ? uint160() : ConnectedChains.ThisChain().GetChainID();
@@ -4526,7 +4526,7 @@ UniValue updateidentity(const UniValue& params, bool fHelp)
         );
     }
 
-    CheckPBaaSAPIsValid();
+    CheckIdentityAPIsValid();
 
     // get identity
     bool returnTx = false;
@@ -4632,7 +4632,7 @@ UniValue revokeidentity(const UniValue& params, bool fHelp)
         );
     }
 
-    CheckPBaaSAPIsValid();
+    CheckIdentityAPIsValid();
 
     // get identity
     bool returnTx = false;
@@ -4742,7 +4742,7 @@ UniValue recoveridentity(const UniValue& params, bool fHelp)
             + HelpExampleRpc("recoveridentity", "\'{\"name\" : \"myname\"}\'")
         );
     }
-    CheckPBaaSAPIsValid();
+    CheckIdentityAPIsValid();
 
     // get identity
     bool returnTx = false;
@@ -4852,7 +4852,7 @@ UniValue getidentity(const UniValue& params, bool fHelp)
         );
     }
 
-    CheckPBaaSAPIsValid();
+    CheckIdentityAPIsValid();
 
     CTxDestination idID = DecodeDestination(uni_get_str(params[0]));
     if (idID.which() != COptCCParams::ADDRTYPE_ID)
@@ -4927,7 +4927,7 @@ UniValue listidentities(const UniValue& params, bool fHelp)
         );
     }
 
-    CheckPBaaSAPIsValid();
+    CheckIdentityAPIsValid();
 
     std::vector<std::pair<CIdentityMapKey, CIdentityMapValue *>> mine, imsigner, notmine;
 
@@ -5446,33 +5446,33 @@ UniValue getmergedblocktemplate(const UniValue& params, bool fHelp)
 static const CRPCCommand commands[] =
 { //  category              name                      actor (function)         okSafeMode
   //  --------------------- ------------------------  -----------------------  ----------
-    { "pbaas",        "definechain",                  &definechain,            true  },
-    { "pbaas",        "getdefinedchains",             &getdefinedchains,       true  },
-    { "pbaas",        "getchaindefinition",           &getchaindefinition,     true  },
-    { "pbaas",        "getnotarizationdata",          &getnotarizationdata,    true  },
-    { "pbaas",        "getcrossnotarization",         &getcrossnotarization,   true  },
-    { "pbaas",        "submitacceptednotarization",   &submitacceptednotarization, true },
-    { "pbaas",        "paynotarizationrewards",       &paynotarizationrewards, true  },
-    { "pbaas",        "getinitialcurrencystate",      &getinitialcurrencystate, true  },
-    { "pbaas",        "getcurrencystate",             &getcurrencystate,       true  },
-    { "pbaas",        "sendreserve",                  &sendreserve,            true  },
-    { "pbaas",        "getpendingchaintransfers",     &getpendingchaintransfers, true  },
-    { "pbaas",        "getchainexports",              &getchainexports,        true  },
-    { "pbaas",        "getchainimports",              &getchainimports,        true  },
-    { "pbaas",        "reserveexchange",              &reserveexchange,        true  },
-    { "pbaas",        "getlatestimportsout",          &getlatestimportsout,    true  },
-    { "pbaas",        "getlastimportin",              &getlastimportin,        true  },
-    { "pbaas",        "refundfailedlaunch",           &refundfailedlaunch,     true  },
-    { "pbaas",        "registernamecommitment",       &registernamecommitment, true  },
-    { "pbaas",        "registeridentity",             &registeridentity,       true  },
-    { "pbaas",        "updateidentity",               &updateidentity,         true  },
-    { "pbaas",        "revokeidentity",               &revokeidentity,         true  },
-    { "pbaas",        "recoveridentity",              &recoveridentity,        true  },
-    { "pbaas",        "getidentity",                  &getidentity,            true  },
-    { "pbaas",        "listidentities",               &listidentities,         true  },
-    { "pbaas",        "refundfailedlaunch",           &refundfailedlaunch,     true  },
-    { "pbaas",        "getmergedblocktemplate",       &getmergedblocktemplate, true  },
-    { "pbaas",        "addmergedblock",               &addmergedblock,         true  }
+    { "identity",     "registernamecommitment",       &registernamecommitment, true  },
+    { "identity",     "registeridentity",             &registeridentity,       true  },
+    { "identity",     "updateidentity",               &updateidentity,         true  },
+    { "identity",     "revokeidentity",               &revokeidentity,         true  },
+    { "identity",     "recoveridentity",              &recoveridentity,        true  },
+    { "identity",     "getidentity",                  &getidentity,            true  },
+    { "identity",     "listidentities",               &listidentities,         true  },
+    { "PBaaS",        "definechain",                  &definechain,            true  },
+    { "PBaaS",        "getdefinedchains",             &getdefinedchains,       true  },
+    { "PBaaS",        "getchaindefinition",           &getchaindefinition,     true  },
+    { "PBaaS",        "getnotarizationdata",          &getnotarizationdata,    true  },
+    { "PBaaS",        "getcrossnotarization",         &getcrossnotarization,   true  },
+    { "PBaaS",        "submitacceptednotarization",   &submitacceptednotarization, true },
+    { "PBaaS",        "paynotarizationrewards",       &paynotarizationrewards, true  },
+    { "PBaaS",        "getinitialcurrencystate",      &getinitialcurrencystate, true  },
+    { "PBaaS",        "getcurrencystate",             &getcurrencystate,       true  },
+    { "PBaaS",        "sendreserve",                  &sendreserve,            true  },
+    { "PBaaS",        "getpendingchaintransfers",     &getpendingchaintransfers, true  },
+    { "PBaaS",        "getchainexports",              &getchainexports,        true  },
+    { "PBaaS",        "getchainimports",              &getchainimports,        true  },
+    { "PBaaS",        "reserveexchange",              &reserveexchange,        true  },
+    { "PBaaS",        "getlatestimportsout",          &getlatestimportsout,    true  },
+    { "PBaaS",        "getlastimportin",              &getlastimportin,        true  },
+    { "PBaaS",        "refundfailedlaunch",           &refundfailedlaunch,     true  },
+    { "PBaaS",        "refundfailedlaunch",           &refundfailedlaunch,     true  },
+    { "PBaaS",        "getmergedblocktemplate",       &getmergedblocktemplate, true  },
+    { "PBaaS",        "addmergedblock",               &addmergedblock,         true  }
 };
 
 void RegisterPBaaSRPCCommands(CRPCTable &tableRPC)
This page took 0.057323 seconds and 4 git commands to generate.