From 832a0e09c6428dc8a7090f18c80bc737dbf324de Mon Sep 17 00:00:00 2001 From: Scott Nadal Date: Sun, 8 Apr 2012 23:43:39 +0100 Subject: [PATCH] PPCoin: Protocol rule to match coinbase and coinstake scriptPubKey --- src/main.cpp | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 388f1db..702518e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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")); -- 1.7.1