// Kernel (input 0) must match the stake hash target per coin age (nBits)
const CTxIn& txin = tx.vin[0];
-
unsigned nTxPos;
CTransaction txPrev;
else
return fDebug? error("CheckProofOfStake() : read block failed") : false; // unable to read block of previous transaction
- // Verify signature
- if (!VerifySignature(coins, tx, 0, true, false, 0))
+ const CTxOut& txout = txPrev.vout[txin.prevout.n];
+
+ // Verify script
+ if (!VerifyScript(txin.scriptSig, txout.scriptPubKey, tx, 0, true, false, 0))
{
fFatal = true;
- return error("CheckProofOfStake() : VerifySignature failed on coinstake %s", tx.GetHash().ToString().c_str());
+ return error("CheckProofOfStake() : VerifyScript failed on coinstake %s", tx.GetHash().ToString().c_str());
}
if (!CheckStakeKernelHash(nBits, block, nTxPos, txPrev, txin.prevout, tx.nTime, hashProofOfStake, targetProofOfStake, fFatal, fMiner, fDebug))
bool fFatal = false;
uint256 hashProofOfStake;
- // Verify proof-of-stake hash target and signatures
+ // Verify proof-of-stake script, hash target and signature
if (!pblock->CheckSignature(fFatal, hashProofOfStake))
{
if (fFatal)
{
- // Invalid blockhash/coinstake signature or no generator defined, nothing to do here
+ // Invalid coinstake script, blockhash signature or no generator defined, nothing to do here
// This also may occur when supplied proof-of-stake doesn't satisfy required target
if (pfrom)
pfrom->Misbehaving(100);
- return error("ProcessBlock() : invalid signature in proof-of-stake block %s", hash.ToString().c_str());
+ return error("ProcessBlock() : invalid signatures found in proof-of-stake block %s", hash.ToString().c_str());
}
else
{
const CTxIn& txin = txTo.vin[nIn];
if (txin.prevout.n >= txFrom.vout.size())
return false;
+
const CTxOut& txout = txFrom.vout[txin.prevout.n];
return VerifyScript(txin.scriptSig, txout.scriptPubKey, txTo, nIn, fValidatePayToScriptHash, fStrictEncodings, nHashType);