From 83a426bc914d17c8d79ebc2ce336392206003548 Mon Sep 17 00:00:00 2001 From: miketout Date: Fri, 12 Oct 2018 16:53:53 -0700 Subject: [PATCH] Adjust cheat catcher height --- src/cheatcatcher.cpp | 2 +- src/cheatcatcher.h | 4 ++-- src/miner.cpp | 5 +++-- src/wallet/wallet.cpp | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cheatcatcher.cpp b/src/cheatcatcher.cpp index 396c2d9bd..65288147d 100644 --- a/src/cheatcatcher.cpp +++ b/src/cheatcatcher.cpp @@ -64,7 +64,7 @@ bool CCheatList::IsCheatInList(const CTransaction &tx, CTransaction *cheatTx) LOCK(cs_cheat); range = indexedCheatCandidates.equal_range(utxo); - printf("IsCheatInList - found candidates: %s\n", range.first == range.second ? "false" : "true"); + //printf("IsCheatInList - found candidates: %s\n", range.first == range.second ? "false" : "true"); for (auto it = range.first; it != range.second; it++) { diff --git a/src/cheatcatcher.h b/src/cheatcatcher.h index 001b98257..7f6e8cf17 100644 --- a/src/cheatcatcher.h +++ b/src/cheatcatcher.h @@ -65,8 +65,8 @@ class CCheatList bool IsHeightOrGreaterInList(uint32_t height) { auto range = orderedCheatCandidates.equal_range(height); - printf("IsHeightOrGreaterInList: %s\n", range.first == orderedCheatCandidates.end() ? "false" : "true"); - return (range.first == orderedCheatCandidates.end()); + //printf("IsHeightOrGreaterInList: %s\n", range.second == orderedCheatCandidates.end() ? "false" : "true"); + return (range.second == orderedCheatCandidates.end()); } // add a potential cheat transaction to the list. we do this for all stake transactions from orphaned stakes diff --git a/src/miner.cpp b/src/miner.cpp index f9f8f3c8b..afb72e579 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -239,11 +239,12 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount, // check if we should add cheat transaction CBlockIndex *ppast; + int cheatHeight = nHeight - COINBASE_MATURITY < 1 ? 1 : nHeight - COINBASE_MATURITY; if (cheatCatcher && sapling && chainActive.Height() > 100 && - (ppast = chainActive[nHeight - COINBASE_MATURITY]) && + (ppast = chainActive[cheatHeight]) && ppast->IsVerusPOSBlock() && - cheatList.IsHeightOrGreaterInList(nHeight)) + cheatList.IsHeightOrGreaterInList(cheatHeight)) { // get the block and see if there is a cheat candidate for the stake tx CBlock b; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index db512c7e0..92b9c1b3d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -3957,7 +3957,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey) if (!wtxNew.AcceptToMemoryPool(false)) { fprintf(stderr,"commit failed\n"); - // This must not fail. The transaction has already been signed and recorded. + // This must not fail. The transaction has already been signed and recorded. LogPrintf("CommitTransaction(): Error: Transaction not valid\n"); return false; }