PPCoin: Protocol rule to match coinbase and coinstake scriptPubKey
authorScott Nadal <scott.nadal@gmail.com>
Sun, 8 Apr 2012 22:43:39 +0000 (23:43 +0100)
committerScott Nadal <scott.nadal@gmail.com>
Sun, 8 Apr 2012 22:43:39 +0000 (23:43 +0100)
src/main.cpp

index 388f1db..702518e 100644 (file)
@@ -1443,6 +1443,13 @@ bool CBlock::CheckBlock() const
     if (hashMerkleRoot != BuildMerkleTree())
         return DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
 
+    // Coin base vout[0] scriptPubKey must be the same as coin stake vout[1]
+    // scriptPubKey
+    if (vtx.size() > 1 && vtx[1].IsCoinStake() &&
+        vtx[0].vout[0].scriptPubKey != vtx[1].vout[1].scriptPubKey)
+        return DoS(100, error("CheckBlock() : block key mismatch"));
+        
+
     // Check block signature
     if (!CheckBlockSignature())
         return DoS(100, error("CheckBlock() : bad block signature"));