@@ -178,12 +178,12 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
178
178
std::vector<CScriptCheck>* pvChecks = nullptr )
179
179
EXCLUSIVE_LOCKS_REQUIRED(cs_main);
180
180
181
- bool CheckFinalTx (const CBlockIndex* active_chain_tip, const CTransaction& tx)
181
+ bool CheckFinalTxAtTip (const CBlockIndex* active_chain_tip, const CTransaction& tx)
182
182
{
183
183
AssertLockHeld (cs_main);
184
184
assert (active_chain_tip); // TODO: Make active_chain_tip a reference
185
185
186
- // CheckFinalTx () uses active_chain_tip.Height()+1 to evaluate
186
+ // CheckFinalTxAtTip () uses active_chain_tip.Height()+1 to evaluate
187
187
// nLockTime because when IsFinalTx() is called within
188
188
// AcceptBlock(), the height of the block *being*
189
189
// evaluated is what is used. Thus if we want to know if a
@@ -201,7 +201,7 @@ bool CheckFinalTx(const CBlockIndex* active_chain_tip, const CTransaction& tx)
201
201
return IsFinalTx (tx, nBlockHeight, nBlockTime);
202
202
}
203
203
204
- bool CheckSequenceLocks (CBlockIndex* tip,
204
+ bool CheckSequenceLocksAtTip (CBlockIndex* tip,
205
205
const CCoinsView& coins_view,
206
206
const CTransaction& tx,
207
207
LockPoints* lp,
@@ -211,7 +211,7 @@ bool CheckSequenceLocks(CBlockIndex* tip,
211
211
212
212
CBlockIndex index;
213
213
index.pprev = tip;
214
- // CheckSequenceLocks () uses active_chainstate.m_chain.Height()+1 to evaluate
214
+ // CheckSequenceLocksAtTip () uses active_chainstate.m_chain.Height()+1 to evaluate
215
215
// height based locks because when SequenceLocks() is called within
216
216
// ConnectBlock(), the height of the block *being*
217
217
// evaluated is what is used.
@@ -257,7 +257,7 @@ bool CheckSequenceLocks(CBlockIndex* tip,
257
257
// lockPair from CalculateSequenceLocks against tip+1. We know
258
258
// EvaluateSequenceLocks will fail if there was a non-zero sequence
259
259
// lock on a mempool input, so we can use the return value of
260
- // CheckSequenceLocks to indicate the LockPoints validity
260
+ // CheckSequenceLocksAtTip to indicate the LockPoints validity
261
261
int maxInputHeight = 0 ;
262
262
for (const int height : prevheights) {
263
263
// Can ignore mempool inputs since we'll fail if they had non-zero locks
@@ -352,19 +352,19 @@ void CChainState::MaybeUpdateMempoolForReorg(
352
352
const CTransaction& tx = it->GetTx ();
353
353
354
354
// The transaction must be final.
355
- if (!CheckFinalTx (m_chain.Tip (), tx)) return true ;
355
+ if (!CheckFinalTxAtTip (m_chain.Tip (), tx)) return true ;
356
356
LockPoints lp = it->GetLockPoints ();
357
357
const bool validLP{TestLockPointValidity (m_chain, lp)};
358
358
CCoinsViewMemPool view_mempool (&CoinsTip (), *m_mempool);
359
- // CheckSequenceLocks checks if the transaction will be final in the next block to be
359
+ // CheckSequenceLocksAtTip checks if the transaction will be final in the next block to be
360
360
// created on top of the new chain. We use useExistingLockPoints=false so that, instead of
361
361
// using the information in lp (which might now refer to a block that no longer exists in
362
362
// the chain), it will update lp to contain LockPoints relevant to the new chain.
363
- if (!CheckSequenceLocks (m_chain.Tip (), view_mempool, tx, &lp, validLP)) {
364
- // If CheckSequenceLocks fails, remove the tx and don't depend on the LockPoints.
363
+ if (!CheckSequenceLocksAtTip (m_chain.Tip (), view_mempool, tx, &lp, validLP)) {
364
+ // If CheckSequenceLocksAtTip fails, remove the tx and don't depend on the LockPoints.
365
365
return true ;
366
366
} else if (!validLP) {
367
- // If CheckSequenceLocks succeeded, it also updated the LockPoints.
367
+ // If CheckSequenceLocksAtTip succeeded, it also updated the LockPoints.
368
368
// Now update the mempool entry lockpoints as well.
369
369
m_mempool->mapTx .modify (it, [&lp](CTxMemPoolEntry& e) { e.UpdateLockPoints (lp); });
370
370
}
@@ -688,7 +688,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
688
688
// Only accept nLockTime-using transactions that can be mined in the next
689
689
// block; we don't want our mempool filled up with transactions that can't
690
690
// be mined yet.
691
- if (!CheckFinalTx (m_active_chainstate.m_chain .Tip (), tx)) {
691
+ if (!CheckFinalTxAtTip (m_active_chainstate.m_chain .Tip (), tx)) {
692
692
return state.Invalid (TxValidationResult::TX_PREMATURE_SPEND, " non-final" );
693
693
}
694
694
@@ -770,7 +770,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
770
770
// be mined yet.
771
771
// Pass in m_view which has all of the relevant inputs cached. Note that, since m_view's
772
772
// backend was removed, it no longer pulls coins from the mempool.
773
- if (!CheckSequenceLocks (m_active_chainstate.m_chain .Tip (), m_view, tx, &lp)) {
773
+ if (!CheckSequenceLocksAtTip (m_active_chainstate.m_chain .Tip (), m_view, tx, &lp)) {
774
774
return state.Invalid (TxValidationResult::TX_PREMATURE_SPEND, " non-BIP68-final" );
775
775
}
776
776
0 commit comments