diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -946,7 +946,7 @@ cashaddr.cpp # via cashaddrenc.cpp cashaddrenc.cpp # via key_io.cpp dnsseeds.cpp # via net.cpp (GetRandomizedDNSSeeds) - i2p.cpp # via net.cpp + i2p.cpp # via net.cppTx key_io.cpp # avalanche/processor.cpp uses DecodeSecret minerfund.cpp # via policy/block/minerfund.cpp net.cpp # avalanche uses CConnman diff --git a/src/txmempool.h b/src/txmempool.h --- a/src/txmempool.h +++ b/src/txmempool.h @@ -33,7 +33,6 @@ #include <utility> #include <vector> -class CBlockIndex; class CChain; class Chainstate; class Config; @@ -52,19 +51,8 @@ // of this tx given our view of block chain history int height{0}; int64_t time{0}; - // As long as the current chain descends from the highest height block - // containing one of the inputs used in the calculation, then the cached - // values are still valid even after a reorg. - CBlockIndex *maxInputBlock{nullptr}; }; -/** - * Test whether the LockPoints height and time are still valid on the current - * chain. - */ -bool TestLockPointValidity(const CChain &active_chain, const LockPoints &lp) - EXCLUSIVE_LOCKS_REQUIRED(cs_main); - struct CompareIteratorById { // SFINAE for T where T is either a std::reference_wrapper<T> (e.g. a // CTxMemPoolEntryRef) or an iterator to a pointer type (e.g., a txiter) @@ -178,8 +166,6 @@ // Updates the fee delta used for mining priority score void UpdateFeeDelta(Amount feeDelta); - // Update the LockPoints after a reorg - void UpdateLockPoints(const LockPoints &lp); bool GetSpendsCoinbase() const { return spendsCoinbase; } diff --git a/src/txmempool.cpp b/src/txmempool.cpp --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -5,8 +5,6 @@ #include <txmempool.h> -#include <chain.h> -#include <chainparams.h> // for GetConsensus. #include <clientversion.h> #include <coins.h> #include <config.h> @@ -28,24 +26,6 @@ #include <cmath> #include <limits> -bool TestLockPointValidity(const CChain &active_chain, const LockPoints &lp) { - AssertLockHeld(cs_main); - // 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, const Amount fee, int64_t time, unsigned int entry_height, bool spends_coinbase, int64_t _sigChecks, @@ -63,10 +43,6 @@ feeDelta = newFeeDelta; } -void CTxMemPoolEntry::UpdateLockPoints(const LockPoints &lp) { - lockPoints = lp; -} - bool CTxMemPool::CalculateAncestors( setEntries &setAncestors, CTxMemPoolEntry::Parents &staged_ancestors) const { diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -197,33 +197,6 @@ if (lp) { lp->height = lockPair.first; lp->time = lockPair.second; - // Also store the hash of the block with the highest height of all - // the blocks which have sequence locked prevouts. This hash needs - // to still be on the chain for these LockPoint calculations to be - // valid. - // Note: It is impossible to correctly calculate a maxInputBlock if - // any of the sequence locked inputs depend on unconfirmed txs, - // except in the special case where the relative lock time/height is - // 0, which is equivalent to no sequence lock. Since we assume input - // height of tip+1 for mempool txs and test the resulting lockPair - // from CalculateSequenceLocks against tip+1. We know - // EvaluateSequenceLocks will fail if there was a non-zero sequence - // lock on a mempool input, so we can use the return value of - // CheckSequenceLocksAtTip to indicate the LockPoints validity. - int maxInputHeight = 0; - for (const int height : prevheights) { - // Can ignore mempool inputs since we'll fail if they had - // non-zero locks. - if (height != tip->nHeight + 1) { - maxInputHeight = std::max(maxInputHeight, height); - } - } - // tip->GetAncestor(maxInputHeight) should never return a nullptr - // because maxInputHeight is always less than the tip height. - // It would, however, be a bad bug to continue execution, since a - // LockPoints object with the maxInputBlock member set to nullptr - // signifies no relative lock time. - lp->maxInputBlock = Assert(tip->GetAncestor(maxInputHeight)); } } return EvaluateSequenceLocks(index, lockPair);