From 79b0432dc1dc84329c239eb21b12a3e2597bff68 Mon Sep 17 00:00:00 2001 From: miketout Date: Fri, 12 Oct 2018 14:56:01 -0700 Subject: [PATCH] Fix false positive error --- src/cc/StakeGuard.cpp | 2 ++ src/komodo_bitcoind.h | 5 +++-- src/main.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cc/StakeGuard.cpp b/src/cc/StakeGuard.cpp index a6d04cb67..f7442f9de 100644 --- a/src/cc/StakeGuard.cpp +++ b/src/cc/StakeGuard.cpp @@ -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; diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index fb767da57..0e9105573 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -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; } diff --git a/src/main.cpp b/src/main.cpp index e31613979..b9789a27d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; }