From bb3d3ab770df6a618da8214a8680ad887b73c4d6 Mon Sep 17 00:00:00 2001 From: miketout Date: Fri, 12 Oct 2018 15:43:15 -0700 Subject: [PATCH] Keep cheatcatcher's lists in sync --- src/cheatcatcher.cpp | 6 +++++- src/cheatcatcher.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cheatcatcher.cpp b/src/cheatcatcher.cpp index 27c5e4746..396c2d9bd 100644 --- a/src/cheatcatcher.cpp +++ b/src/cheatcatcher.cpp @@ -63,6 +63,9 @@ 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"); + for (auto it = range.first; it != range.second; it++) { CTransaction &cTx = it->second->tx; @@ -108,12 +111,13 @@ void CCheatList::Remove(const CTxHolder &txh) uint256 hash = txh.tx.GetHash(); if (hash == it->second->tx.GetHash()) { - utxoPrune.push_back(it); auto hrange = orderedCheatCandidates.equal_range(it->second->height); for (auto hit = hrange.first; hit != hrange.second; hit++) { if (hit->second.tx.GetHash() == hash) { + // add and remove them together + utxoPrune.push_back(it); heightPrune.push_back(hit); } } diff --git a/src/cheatcatcher.h b/src/cheatcatcher.h index cff210c85..001b98257 100644 --- a/src/cheatcatcher.h +++ b/src/cheatcatcher.h @@ -65,6 +65,7 @@ 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()); }