@@ -287,11 +287,15 @@ bool BlockAssembler::TestPackage(uint64_t packageSize, unsigned int packageSigOp
287
287
288
288
// Perform transaction-level checks before adding to block:
289
289
// - transaction finality (locktime)
290
+ // - safe TXs in regard to ChainLocks
290
291
bool BlockAssembler::TestPackageTransactions (const CTxMemPool::setEntries& package)
291
292
{
292
293
BOOST_FOREACH (const CTxMemPool::txiter it, package) {
293
294
if (!IsFinalTx (it->GetTx (), nHeight, nLockTimeCutoff))
294
295
return false ;
296
+ if (!llmq::chainLocksHandler->IsTxSafeForMining (it->GetTx ().GetHash ())) {
297
+ return false ;
298
+ }
295
299
}
296
300
return true ;
297
301
}
@@ -333,6 +337,10 @@ bool BlockAssembler::TestForBlock(CTxMemPool::txiter iter)
333
337
if (!IsFinalTx (iter->GetTx (), nHeight, nLockTimeCutoff))
334
338
return false ;
335
339
340
+ if (!llmq::chainLocksHandler->IsTxSafeForMining (iter->GetTx ().GetHash ())) {
341
+ return false ;
342
+ }
343
+
336
344
return true ;
337
345
}
338
346
@@ -454,12 +462,6 @@ void BlockAssembler::addPackageTxs(int &nPackagesSelected, int &nDescendantsUpda
454
462
continue ;
455
463
}
456
464
457
- if (mi != mempool.mapTx .get <ancestor_score>().end () &&
458
- !llmq::chainLocksHandler->IsTxSafeForMining (mi->GetTx ().GetHash ())) {
459
- ++mi;
460
- continue ;
461
- }
462
-
463
465
// Now that mi is not stale, determine which transaction to evaluate:
464
466
// the next entry from mapTx, or the best from mapModifiedTx?
465
467
bool fUsingModified = false ;
@@ -530,7 +532,7 @@ void BlockAssembler::addPackageTxs(int &nPackagesSelected, int &nDescendantsUpda
530
532
onlyUnconfirmed (ancestors);
531
533
ancestors.insert (iter);
532
534
533
- // Test if all tx's are Final
535
+ // Test if all tx's are Final and safe
534
536
if (!TestPackageTransactions (ancestors)) {
535
537
if (fUsingModified ) {
536
538
mapModifiedTx.get <ancestor_score>().erase (modit);
@@ -608,10 +610,6 @@ void BlockAssembler::addPriorityTxs()
608
610
continue ;
609
611
}
610
612
611
- if (!llmq::chainLocksHandler->IsTxSafeForMining (iter->GetTx ().GetHash ())) {
612
- continue ;
613
- }
614
-
615
613
// If this tx fits in the block add it, otherwise keep looping
616
614
if (TestForBlock (iter)) {
617
615
AddToBlock (iter);
0 commit comments