Cleanup cheatcatcher
This commit is contained in:
@@ -45,6 +45,13 @@ uint32_t CCheatList::Prune(uint32_t height)
|
|||||||
|
|
||||||
bool GetStakeParams(const CTransaction &stakeTx, CStakeParams &stakeParams);
|
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)
|
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
|
// 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);
|
LOCK(cs_cheat);
|
||||||
auto it = orderedCheatCandidates.insert(pair<const uint32_t, CTxHolder>(txh.height, txh));
|
auto it = orderedCheatCandidates.insert(pair<const uint32_t, CTxHolder>(txh.height, txh));
|
||||||
indexedCheatCandidates.insert(pair<const uint256, CTxHolder *>(txh.utxo, &it->second));
|
indexedCheatCandidates.insert(pair<const uint256, CTxHolder *>(txh.utxo, &it->second));
|
||||||
|
printf("CCheatList::Add orderedCheatCandidates.size: %d, indexedCheatCandidates.size: %d\n", orderedCheatCandidates.size(), indexedCheatCandidates.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,12 +62,7 @@ class CCheatList
|
|||||||
bool IsCheatInList(const CTransaction &tx, CTransaction *pcheatTx);
|
bool IsCheatInList(const CTransaction &tx, CTransaction *pcheatTx);
|
||||||
|
|
||||||
// check to see if there are cheat candidates of the same or greater block height in list
|
// check to see if there are cheat candidates of the same or greater block height in list
|
||||||
bool IsHeightOrGreaterInList(uint32_t height)
|
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
// add a potential cheat transaction to the list. we do this for all stake transactions from orphaned stakes
|
// add a potential cheat transaction to the list. we do this for all stake transactions from orphaned stakes
|
||||||
bool Add(const CTxHolder &txh);
|
bool Add(const CTxHolder &txh);
|
||||||
|
|||||||
Reference in New Issue
Block a user