Minor refactoring of CheckBlockSignature()
authorCryptoManiac <balthazar@yandex.ru>
Mon, 27 Apr 2015 02:36:35 +0000 (19:36 -0700)
committerCryptoManiac <balthazar@yandex.ru>
Mon, 27 Apr 2015 02:36:35 +0000 (19:36 -0700)
src/main.cpp

index 70bdce4..b4a03a5 100644 (file)
@@ -2650,26 +2650,23 @@ bool ProcessBlock(CNode* pfrom, CBlock* pblock)
 // ppcoin: check block signature
 bool CBlock::CheckBlockSignature() const
 {
-    if (IsProofOfWork())
-        return true;
+    if (vchBlockSig.empty())
+        return false;
 
-    vector<valtype> vSolutions;
     txnouttype whichType;
-
-    const CTxOut& txout = vtx[1].vout[1];
-
-    if (!Solver(txout.scriptPubKey, whichType, vSolutions))
+    vector<valtype> vSolutions;
+    if (!Solver(vtx[1].vout[1].scriptPubKey, whichType, vSolutions))
         return false;
+
     if (whichType == TX_PUBKEY)
     {
         valtype& vchPubKey = vSolutions[0];
         CKey key;
         if (!key.SetPubKey(vchPubKey))
             return false;
-        if (vchBlockSig.empty())
-            return false;
         return key.Verify(GetHash(), vchBlockSig);
     }
+
     return false;
 }