Cleanup cheatcatcher

This commit is contained in:
miketout
2018-10-12 22:41:43 -07:00
parent 54036e72cd
commit 1ca4abe444
2 changed files with 9 additions and 6 deletions

View File

@@ -45,6 +45,13 @@ uint32_t CCheatList::Prune(uint32_t height)
bool GetStakeParams(const CTransaction &stakeTx, CStakeParams &stakeParams);
bool CCheatList::IsHeightOrGreaterInList(uint32_t height)
{
auto range = orderedCheatCandidates.equal_range(height);
//printf("IsHeightOrGreaterInList: %s\n", range.second == orderedCheatCandidates.end() ? "false" : "true");
return (range.second != orderedCheatCandidates.end());
}
bool CCheatList::IsCheatInList(const CTransaction &tx, CTransaction *cheatTx)
{
// for a tx to be cheat, it needs to spend the same UTXO and be for a different prior block
@@ -92,6 +99,7 @@ bool CCheatList::Add(const CTxHolder &txh)
LOCK(cs_cheat);
auto it = orderedCheatCandidates.insert(pair<const uint32_t, CTxHolder>(txh.height, txh));
indexedCheatCandidates.insert(pair<const uint256, CTxHolder *>(txh.utxo, &it->second));
printf("CCheatList::Add orderedCheatCandidates.size: %d, indexedCheatCandidates.size: %d\n", orderedCheatCandidates.size(), indexedCheatCandidates.size());
}
}

View File

@@ -62,12 +62,7 @@ class CCheatList
bool IsCheatInList(const CTransaction &tx, CTransaction *pcheatTx);
// check to see if there are cheat candidates of the same or greater block height in list
bool IsHeightOrGreaterInList(uint32_t height)
{
auto range = orderedCheatCandidates.equal_range(height);
//printf("IsHeightOrGreaterInList: %s\n", range.second == orderedCheatCandidates.end() ? "false" : "true");
return (range.second == orderedCheatCandidates.end());
}
bool IsHeightOrGreaterInList(uint32_t height);
// add a potential cheat transaction to the list. we do this for all stake transactions from orphaned stakes
bool Add(const CTxHolder &txh);