@@ -3085,34 +3085,6 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
3085
3085
}
3086
3086
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
3087
3087
3088
- // Remove orphan transactions with cs_main
3089
- {
3090
- LOCK (cs_main);
3091
- for (unsigned int i = 0 ; i < txChanged.size (); i++) {
3092
- std::vector<uint256> vOrphanErase;
3093
- const CTransaction& tx = std::get<0 >(txChanged[i]);
3094
- // Which orphan pool entries must we evict?
3095
- for (size_t j = 0 ; j < tx.vin .size (); j++) {
3096
- auto itByPrev = mapOrphanTransactionsByPrev.find (tx.vin [j].prevout );
3097
- if (itByPrev == mapOrphanTransactionsByPrev.end ()) continue ;
3098
- for (auto mi = itByPrev->second .begin (); mi != itByPrev->second .end (); ++mi) {
3099
- const CTransaction& orphanTx = (*mi)->second .tx ;
3100
- const uint256& orphanHash = orphanTx.GetHash ();
3101
- vOrphanErase.push_back (orphanHash);
3102
- }
3103
- }
3104
-
3105
- // Erase orphan transactions include or precluded by this block
3106
- if (vOrphanErase.size ()) {
3107
- int nErased = 0 ;
3108
- BOOST_FOREACH (uint256 &orphanHash, vOrphanErase) {
3109
- nErased += EraseOrphanTx (orphanHash);
3110
- }
3111
- LogPrint (" mempool" , " Erased %d orphan tx included or conflicted by block\n " , nErased);
3112
- }
3113
- }
3114
- }
3115
-
3116
3088
// Notifications/callbacks that can run without cs_main
3117
3089
3118
3090
// throw all transactions though the signal-interface
@@ -4752,6 +4724,34 @@ PeerLogicValidation::PeerLogicValidation(CConnman* connmanIn) : connman(connmanI
4752
4724
recentRejects.reset (new CRollingBloomFilter (120000 , 0.000001 ));
4753
4725
}
4754
4726
4727
+ void PeerLogicValidation::SyncTransaction (const CTransaction& tx, const CBlockIndex* pindex, int nPosInBlock) {
4728
+ if (nPosInBlock == CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK)
4729
+ return ;
4730
+
4731
+ LOCK (cs_main);
4732
+
4733
+ std::vector<uint256> vOrphanErase;
4734
+ // Which orphan pool entries must we evict?
4735
+ for (size_t j = 0 ; j < tx.vin .size (); j++) {
4736
+ auto itByPrev = mapOrphanTransactionsByPrev.find (tx.vin [j].prevout );
4737
+ if (itByPrev == mapOrphanTransactionsByPrev.end ()) continue ;
4738
+ for (auto mi = itByPrev->second .begin (); mi != itByPrev->second .end (); ++mi) {
4739
+ const CTransaction& orphanTx = (*mi)->second .tx ;
4740
+ const uint256& orphanHash = orphanTx.GetHash ();
4741
+ vOrphanErase.push_back (orphanHash);
4742
+ }
4743
+ }
4744
+
4745
+ // Erase orphan transactions include or precluded by this block
4746
+ if (vOrphanErase.size ()) {
4747
+ int nErased = 0 ;
4748
+ BOOST_FOREACH (uint256 &orphanHash, vOrphanErase) {
4749
+ nErased += EraseOrphanTx (orphanHash);
4750
+ }
4751
+ LogPrint (" mempool" , " Erased %d orphan tx included or conflicted by block\n " , nErased);
4752
+ }
4753
+ }
4754
+
4755
4755
void PeerLogicValidation::UpdatedBlockTip (const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload ) {
4756
4756
const int nNewHeight = pindexNew->nHeight ;
4757
4757
connman->SetBestHeight (nNewHeight);
0 commit comments