]> Git Repo - VerusCoin.git/commitdiff
Fix issue loading block 1 added logic to skip indexing if at all possible
authormiketout <[email protected]>
Wed, 9 Oct 2019 23:43:41 +0000 (16:43 -0700)
committermiketout <[email protected]>
Wed, 9 Oct 2019 23:43:41 +0000 (16:43 -0700)
src/init.cpp
src/main.cpp

index 8cdb2177677e82fe20b7b42fb405c5cce58aba70..a8fa4ddcce5f4ae86da246281c91bd683d08b677 100644 (file)
@@ -1568,17 +1568,19 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
             fReindex = true;
         }
 
-        fTimeStampIndex = GetBoolArg("-timestampindex", DEFAULT_TIMESTAMPINDEX);
         pblocktree->ReadFlag("timestampindex", checkval);
+        bool defaultState = DEFAULT_TIMESTAMPINDEX ? DEFAULT_TIMESTAMPINDEX : checkval;
+        fTimeStampIndex = GetBoolArg("-timestampindex", defaultState);
         if (checkval != fTimeStampIndex)
         {
-            pblocktree->WriteFlag("timestampindex", fInsightExplorer);
+            pblocktree->WriteFlag("timestampindex", fTimeStampIndex);
             fprintf(stderr,"set timestamp index, will reindex. sorry will take a while.\n");
             fReindex = true;
         }
 
-        fInsightExplorer = GetBoolArg("-insightexplorer", DEFAULT_INSIGHTEXPLORER);
         pblocktree->ReadFlag("insightexplorer", checkval);
+        defaultState = DEFAULT_INSIGHTEXPLORER ? DEFAULT_INSIGHTEXPLORER : checkval;
+        fInsightExplorer = GetBoolArg("-insightexplorer", defaultState);
         if (checkval != fInsightExplorer)
         {
             pblocktree->WriteFlag("insightexplorer", fInsightExplorer);
index 9f24fe35ca1acb2420591c433076b3e1587ee36f..4597ea791c7dec2814386c18a3fbc45117b1142f 100644 (file)
@@ -2221,7 +2221,7 @@ bool ReadBlockFromDisk(int32_t height, CBlock& block, const CDiskBlockPos& pos,
         return error("%s: Deserialize or I/O error - %s at %s", __func__, e.what(), pos.ToString());
     }
     // Check the header
-    if ( checkPOW != 0 )
+    if ( height != 0 && checkPOW != 0 )
     {
         komodo_block2pubkey33(pubkey33,(CBlock *)&block);
         if (!(CheckEquihashSolution(&block, consensusParams) && CheckProofOfWork(block, pubkey33, height, consensusParams)))
@@ -2233,6 +2233,10 @@ bool ReadBlockFromDisk(int32_t height, CBlock& block, const CDiskBlockPos& pos,
             return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
         }
     }
+    else if (height == 0 && block.GetHash() !=  consensusParams.hashGenesisBlock)
+    {
+        return error("ReadBlockFromDisk: Invalid block 0 genesis hash %s", block.GetHash().GetHex());
+    }
     return true;
 }
 
This page took 0.039966 seconds and 4 git commands to generate.