From 1b3a11e126b258fba975ed7c452221608f2c5472 Mon Sep 17 00:00:00 2001 From: glozow Date: Tue, 30 Nov 2021 11:21:02 +0000 Subject: MOVEONLY: TestLockPointValidity to txmempool --- src/txmempool.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/txmempool.cpp') diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 502a27dc6b..05b22bb39b 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -74,6 +74,24 @@ private: const LockPoints& lp; }; +bool TestLockPointValidity(CChain& active_chain, const LockPoints* lp) +{ + AssertLockHeld(cs_main); + assert(lp); + // If there are relative lock times then the maxInputBlock will be set + // If there are no relative lock times, the LockPoints don't depend on the chain + if (lp->maxInputBlock) { + // Check whether active_chain is an extension of the block at which the LockPoints + // calculation was valid. If not LockPoints are no longer valid + if (!active_chain.Contains(lp->maxInputBlock)) { + return false; + } + } + + // LockPoints still valid + return true; +} + CTxMemPoolEntry::CTxMemPoolEntry(const CTransactionRef& tx, CAmount fee, int64_t time, unsigned int entry_height, bool spends_coinbase, int64_t sigops_cost, LockPoints lp) -- cgit v1.2.3