aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2021-12-02 11:51:21 +0000
committerglozow <gloriajzhao@gmail.com>2021-12-02 14:45:18 +0000
commitc4efc4db5484910ac33ba41aa76f4e23639d6f33 (patch)
treec657c042b503fd8272edb0dcbba07994058af9b2 /src/txmempool.cpp
parentb01784f0270dc20f8076ea4e46203c97b40b93ef (diff)
downloadbitcoin-c4efc4db5484910ac33ba41aa76f4e23639d6f33.tar.xz
change TestLockPointValidity to take a const reference
The lockpoints are not changed in this function. There is no reason to pass a pointer.
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 27fbb8acac..b4ec9bd679 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -73,16 +73,15 @@ private:
const LockPoints& lp;
};
-bool TestLockPointValidity(CChain& active_chain, 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) {
+ 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)) {
+ if (!active_chain.Contains(lp.maxInputBlock)) {
return false;
}
}
@@ -649,8 +648,8 @@ 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++) {
- LockPoints lp = it->GetLockPoints();
- if (!TestLockPointValidity(chain, &lp)) {
+ const LockPoints lp{it->GetLockPoints()};
+ if (!TestLockPointValidity(chain, lp)) {
mapTx.modify(it, update_lock_points(lp));
}
}