aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/txmempool.cpp15
-rw-r--r--src/txmempool.h10
-rw-r--r--src/validation.cpp2
3 files changed, 13 insertions, 14 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 66beb0a9b3..dc2769b81e 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -64,16 +64,6 @@ private:
int64_t feeDelta;
};
-struct update_lock_points
-{
- explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { }
-
- void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); }
-
-private:
- const LockPoints& lp;
-};
-
bool TestLockPointValidity(CChain& active_chain, const LockPoints& lp)
{
AssertLockHeld(cs_main);
@@ -649,10 +639,7 @@ void CTxMemPool::removeForReorg(CChain& chain, std::function<bool(txiter)> check
}
RemoveStaged(setAllRemoves, false, MemPoolRemovalReason::REORG);
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
- const LockPoints lp{it->GetLockPoints()};
- if (!TestLockPointValidity(chain, lp)) {
- mapTx.modify(it, update_lock_points(lp));
- }
+ assert(TestLockPointValidity(chain, it->GetLockPoints()));
}
}
diff --git a/src/txmempool.h b/src/txmempool.h
index df578d5111..b8c508fd90 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -312,6 +312,16 @@ public:
}
};
+struct update_lock_points
+{
+ explicit update_lock_points(const LockPoints& _lp) : lp(_lp) { }
+
+ void operator() (CTxMemPoolEntry &e) { e.UpdateLockPoints(lp); }
+
+private:
+ const LockPoints& lp;
+};
+
// Multi_index tag names
struct descendant_score {};
struct entry_time {};
diff --git a/src/validation.cpp b/src/validation.cpp
index cb2b60b481..fba3ef26c7 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -375,6 +375,8 @@ void CChainState::MaybeUpdateMempoolForReorg(
}
}
}
+ // CheckSequenceLocks updates lp. Update the mempool entry LockPoints.
+ if (!validLP) m_mempool->mapTx.modify(it, update_lock_points(lp));
return should_remove;
};