From 60de0d5826f1b848a43ec989ff712f002eddc3dc Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Wed, 23 Sep 2015 13:37:32 -0400 Subject: Fix mempool package tracking edge case CalculateMemPoolAncestors was always looping over a transaction's inputs to find in-mempool parents. When adding a new transaction, this is the correct behavior, but when removing a transaction, we want to use the ancestor set that would be calculated by walking mapLinks (which should in general be the same set, except during a reorg when the mempool is in an inconsistent state, and the mapLinks-based calculation would be the correct one). --- src/txmempool.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/txmempool.h') diff --git a/src/txmempool.h b/src/txmempool.h index f0c3f7e0f..c0eef0dd2 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -392,8 +392,10 @@ public: * limitDescendantCount = max number of descendants any ancestor can have * limitDescendantSize = max size of descendants any ancestor can have * errString = populated with error reason if any limits are hit + * fSearchForParents = whether to search a tx's vin for in-mempool parents, or + * look up parents from mapLinks. Must be true for entries not in the mempool */ - bool CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString); + bool CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString, bool fSearchForParents = true); unsigned long size() { -- cgit v1.2.3