From ab833188a3492cbc199140b79d9b413fcc0671ea Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sun, 26 Apr 2015 19:36:35 -0700 Subject: [PATCH] Minor refactoring of CheckBlockSignature() --- src/main.cpp | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 70bdce4..b4a03a5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 vSolutions; txnouttype whichType; - - const CTxOut& txout = vtx[1].vout[1]; - - if (!Solver(txout.scriptPubKey, whichType, vSolutions)) + vector 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; } -- 1.7.1