PPCoin: Only serialize stake to blockindex for proof-of-stake blocks
authorSunny King <sunnyking9999@gmail.com>
Fri, 8 Jun 2012 01:42:59 +0000 (02:42 +0100)
committerSunny King <sunnyking9999@gmail.com>
Fri, 8 Jun 2012 01:42:59 +0000 (02:42 +0100)
src/main.h

index 3e60fb9..2baf7c4 100644 (file)
@@ -1334,8 +1334,16 @@ public:
         READWRITE(nHeight);
         READWRITE(nCheckpoint);
         READWRITE(fProofOfStake);
-        READWRITE(prevoutStake);
-        READWRITE(nStakeTime);
+        if (fProofOfStake)
+        {
+            READWRITE(prevoutStake);
+            READWRITE(nStakeTime);
+        }
+        else if (fRead)
+        {
+            const_cast<CDiskBlockIndex*>(this)->prevoutStake.SetNull();
+            const_cast<CDiskBlockIndex*>(this)->nStakeTime = 0;
+        }
 
         // block header
         READWRITE(this->nVersion);