|
5 | 5 |
|
6 | 6 | #include <txmempool.h> |
7 | 7 |
|
| 8 | +#include <chain.h> |
8 | 9 | #include <coins.h> |
9 | 10 | #include <consensus/consensus.h> |
10 | 11 | #include <consensus/tx_verify.h> |
@@ -81,16 +82,15 @@ struct update_lock_points |
81 | 82 | const LockPoints& lp; |
82 | 83 | }; |
83 | 84 |
|
84 | | -bool TestLockPointValidity(CChain& active_chain, const LockPoints* lp) |
| 85 | +bool TestLockPointValidity(CChain& active_chain, const LockPoints& lp) |
85 | 86 | { |
86 | 87 | AssertLockHeld(cs_main); |
87 | | - assert(lp); |
88 | 88 | // If there are relative lock times then the maxInputBlock will be set |
89 | 89 | // If there are no relative lock times, the LockPoints don't depend on the chain |
90 | | - if (lp->maxInputBlock) { |
| 90 | + if (lp.maxInputBlock) { |
91 | 91 | // Check whether active_chain is an extension of the block at which the LockPoints |
92 | 92 | // calculation was valid. If not LockPoints are no longer valid |
93 | | - if (!active_chain.Contains(lp->maxInputBlock)) { |
| 93 | + if (!active_chain.Contains(lp.maxInputBlock)) { |
94 | 94 | return false; |
95 | 95 | } |
96 | 96 | } |
@@ -892,8 +892,8 @@ void CTxMemPool::removeForReorg(CChain& chain, std::function<bool(txiter)> check |
892 | 892 | } |
893 | 893 | RemoveStaged(setAllRemoves, false, MemPoolRemovalReason::REORG); |
894 | 894 | for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) { |
895 | | - LockPoints lp = it->GetLockPoints(); |
896 | | - if (!TestLockPointValidity(chain, &lp)) { |
| 895 | + const LockPoints lp{it->GetLockPoints()}; |
| 896 | + if (!TestLockPointValidity(chain, lp)) { |
897 | 897 | mapTx.modify(it, update_lock_points(lp)); |
898 | 898 | } |
899 | 899 | } |
|
0 commit comments