PPCoin: Only call CheckProofOfWork() for proof-of-work blocks
authorSunny King <sunnyking9999@gmail.com>
Wed, 25 Apr 2012 03:30:34 +0000 (04:30 +0100)
committerSunny King <sunnyking9999@gmail.com>
Wed, 25 Apr 2012 03:30:34 +0000 (04:30 +0100)
        Fix ERROR: CheckProofOfWork() : hash doesn't match nBits
            ERROR: LoadBlockIndex() : CheckIndex failed at ***

src/main.h

index 3ad6a04..6244695 100644 (file)
@@ -1004,7 +1004,7 @@ public:
         filein >> *this;
 
         // Check the header
-        if (!CheckProofOfWork(GetHash(), nBits))
+        if (IsProofOfWork() && !CheckProofOfWork(GetHash(), nBits))
             return error("CBlock::ReadFromDisk() : errors in block header");
 
         return true;
@@ -1199,7 +1199,7 @@ public:
 
     bool CheckIndex() const
     {
-        return CheckProofOfWork(GetBlockHash(), nBits);
+        return IsProofOfWork() ? CheckProofOfWork(GetBlockHash(), nBits) : true;
     }
 
     bool EraseBlockFromDisk()