@@ -2460,7 +2460,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
2460
2460
2461
2461
CCheckQueueControl<CScriptCheck> control (fScriptChecks && nScriptCheckThreads ? &scriptcheckqueue : NULL );
2462
2462
2463
- std::vector<uint256> vOrphanErase;
2464
2463
std::vector<int > prevheights;
2465
2464
CAmount nFees = 0 ;
2466
2465
int nInputs = 0 ;
@@ -2491,17 +2490,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
2491
2490
prevheights[j] = view.AccessCoins (tx.vin [j].prevout .hash )->nHeight ;
2492
2491
}
2493
2492
2494
- // Which orphan pool entries must we evict?
2495
- for (size_t j = 0 ; j < tx.vin .size (); j++) {
2496
- auto itByPrev = mapOrphanTransactionsByPrev.find (tx.vin [j].prevout );
2497
- if (itByPrev == mapOrphanTransactionsByPrev.end ()) continue ;
2498
- for (auto mi = itByPrev->second .begin (); mi != itByPrev->second .end (); ++mi) {
2499
- const CTransaction& orphanTx = (*mi)->second .tx ;
2500
- const uint256& orphanHash = orphanTx.GetHash ();
2501
- vOrphanErase.push_back (orphanHash);
2502
- }
2503
- }
2504
-
2505
2493
if (!SequenceLocks (tx, nLockTimeFlags, &prevheights, *pindex)) {
2506
2494
return state.DoS (100 , error (" %s: contains a non-BIP68-final transaction" , __func__),
2507
2495
REJECT_INVALID, " bad-txns-nonfinal" );
@@ -2591,14 +2579,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
2591
2579
GetMainSignals ().UpdatedTransaction (hashPrevBestCoinBase);
2592
2580
hashPrevBestCoinBase = block.vtx [0 ]->GetHash ();
2593
2581
2594
- // Erase orphan transactions include or precluded by this block
2595
- if (vOrphanErase.size ()) {
2596
- int nErased = 0 ;
2597
- BOOST_FOREACH (uint256 &orphanHash, vOrphanErase) {
2598
- nErased += EraseOrphanTx (orphanHash);
2599
- }
2600
- LogPrint (" mempool" , " Erased %d orphan tx included or conflicted by block\n " , nErased);
2601
- }
2602
2582
2603
2583
int64_t nTime6 = GetTimeMicros (); nTimeCallbacks += nTime6 - nTime5;
2604
2584
LogPrint (" bench" , " - Callbacks: %.2fms [%.2fs]\n " , 0.001 * (nTime6 - nTime5), nTimeCallbacks * 0.000001 );
@@ -4747,6 +4727,34 @@ PeerLogicValidation::PeerLogicValidation(CConnman* connmanIn) : connman(connmanI
4747
4727
recentRejects.reset (new CRollingBloomFilter (120000 , 0.000001 ));
4748
4728
}
4749
4729
4730
+ void PeerLogicValidation::SyncTransaction (const CTransaction& tx, const CBlockIndex* pindex, int nPosInBlock) {
4731
+ if (nPosInBlock == CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK)
4732
+ return ;
4733
+
4734
+ LOCK (cs_main);
4735
+
4736
+ std::vector<uint256> vOrphanErase;
4737
+ // Which orphan pool entries must we evict?
4738
+ for (size_t j = 0 ; j < tx.vin .size (); j++) {
4739
+ auto itByPrev = mapOrphanTransactionsByPrev.find (tx.vin [j].prevout );
4740
+ if (itByPrev == mapOrphanTransactionsByPrev.end ()) continue ;
4741
+ for (auto mi = itByPrev->second .begin (); mi != itByPrev->second .end (); ++mi) {
4742
+ const CTransaction& orphanTx = (*mi)->second .tx ;
4743
+ const uint256& orphanHash = orphanTx.GetHash ();
4744
+ vOrphanErase.push_back (orphanHash);
4745
+ }
4746
+ }
4747
+
4748
+ // Erase orphan transactions include or precluded by this block
4749
+ if (vOrphanErase.size ()) {
4750
+ int nErased = 0 ;
4751
+ BOOST_FOREACH (uint256 &orphanHash, vOrphanErase) {
4752
+ nErased += EraseOrphanTx (orphanHash);
4753
+ }
4754
+ LogPrint (" mempool" , " Erased %d orphan tx included or conflicted by block\n " , nErased);
4755
+ }
4756
+ }
4757
+
4750
4758
void PeerLogicValidation::UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload ) {
4751
4759
const int nNewHeight = pindexNew->nHeight ;
4752
4760
connman->SetBestHeight (nNewHeight);
0 commit comments