From: CryptoManiac Date: Mon, 27 Apr 2015 02:36:35 +0000 (-0700) Subject: Minor refactoring of CheckBlockSignature() X-Git-Tag: nvc-v0.5.3~15 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=ab833188a3492cbc199140b79d9b413fcc0671ea Minor refactoring of CheckBlockSignature() --- 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; }