Fix false positive error

This commit is contained in:
miketout
2018-10-12 14:56:01 -07:00
parent 085c3640bb
commit 79b0432dc1
3 changed files with 6 additions and 3 deletions

View File

@@ -233,6 +233,8 @@ bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTr
// an invalid or non-matching stake transaction cannot cheat
cheating = false;
//printf("ValidateMatchingStake: ccTx.vin[0].prevout.hash: %s, ccTx.vin[0].prevout.n: %d\n", ccTx.vin[0].prevout.hash.GetHex().c_str(), ccTx.vin[0].prevout.n);
if (ccTx.IsCoinBase())
{
CStakeParams p;

View File

@@ -1517,12 +1517,13 @@ bool verusCheckPOSBlock(int32_t slowflag, CBlock *pblock, int32_t height)
validHash = false;
if (ValidateMatchingStake(pblock->vtx[0], i, pblock->vtx[txn_count-1], validHash) && !validHash)
{
if (p.prevHash == pblock->hashPrevBlock && p.blkHeight == height)
if ((p.prevHash == pblock->hashPrevBlock) && (int32_t)p.blkHeight == height)
{
validHash = true;
}
else
{
printf("ERROR: invalid block data for stake tx\nblkHash: %s\ntxBlkHash: %s\nblkHeight: %d\ntxBlkHeight: %d\n",
printf("ERROR: invalid block data for stake tx\nblkHash: %s\ntxBlkHash: %s\nblkHeight: %d, txBlkHeight: %d\n",
pblock->hashPrevBlock.GetHex().c_str(), p.prevHash.GetHex().c_str(), height, p.blkHeight);
validHash = false;
}

View File

@@ -5015,7 +5015,7 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
// when we succeed here, we prune all cheat candidates in the cheat list to 250 blocks ago, as they should be used or not
// useful by then
if ((height - 250) > 1)
cheatList.Prune(height - 250);
cheatList.Prune(height - 200);
return true;
}