Keep cheatcatcher's lists in sync

This commit is contained in:
miketout
2018-10-12 15:43:15 -07:00
parent 79b0432dc1
commit bb3d3ab770
2 changed files with 6 additions and 1 deletions

View File

@@ -63,6 +63,9 @@ bool CCheatList::IsCheatInList(const CTransaction &tx, CTransaction *cheatTx)
{ {
LOCK(cs_cheat); LOCK(cs_cheat);
range = indexedCheatCandidates.equal_range(utxo); range = indexedCheatCandidates.equal_range(utxo);
printf("IsCheatInList - found candidates: %s\n", range.first == range.second ? "false" : "true");
for (auto it = range.first; it != range.second; it++) for (auto it = range.first; it != range.second; it++)
{ {
CTransaction &cTx = it->second->tx; CTransaction &cTx = it->second->tx;
@@ -108,12 +111,13 @@ void CCheatList::Remove(const CTxHolder &txh)
uint256 hash = txh.tx.GetHash(); uint256 hash = txh.tx.GetHash();
if (hash == it->second->tx.GetHash()) if (hash == it->second->tx.GetHash())
{ {
utxoPrune.push_back(it);
auto hrange = orderedCheatCandidates.equal_range(it->second->height); auto hrange = orderedCheatCandidates.equal_range(it->second->height);
for (auto hit = hrange.first; hit != hrange.second; hit++) for (auto hit = hrange.first; hit != hrange.second; hit++)
{ {
if (hit->second.tx.GetHash() == hash) if (hit->second.tx.GetHash() == hash)
{ {
// add and remove them together
utxoPrune.push_back(it);
heightPrune.push_back(hit); heightPrune.push_back(hit);
} }
} }

View File

@@ -65,6 +65,7 @@ class CCheatList
bool IsHeightOrGreaterInList(uint32_t height) bool IsHeightOrGreaterInList(uint32_t height)
{ {
auto range = orderedCheatCandidates.equal_range(height); auto range = orderedCheatCandidates.equal_range(height);
printf("IsHeightOrGreaterInList: %s\n", range.first == orderedCheatCandidates.end() ? "false" : "true");
return (range.first == orderedCheatCandidates.end()); return (range.first == orderedCheatCandidates.end());
} }