@@ -2179,17 +2179,17 @@ static int64_t nTimePostConnect = 0;
2179
2179
* part of a single ActivateBestChainStep call.
2180
2180
*
2181
2181
* This class also tracks transactions that are removed from the mempool as
2182
- * conflicts and can be used to pass all those transactions through
2183
- * SyncTransaction.
2182
+ * conflicts (per block) and can be used to pass all those transactions
2183
+ * through SyncTransaction.
2184
2184
*/
2185
2185
class ConnectTrace {
2186
2186
private:
2187
2187
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > > blocksConnected;
2188
- std::vector<CTransactionRef> conflictedTxs;
2188
+ std::vector<std::vector< CTransactionRef> > conflictedTxs;
2189
2189
CTxMemPool &pool;
2190
2190
2191
2191
public:
2192
- ConnectTrace (CTxMemPool &_pool) : pool(_pool) {
2192
+ ConnectTrace (CTxMemPool &_pool) : conflictedTxs( 1 ), pool(_pool) {
2193
2193
pool.NotifyEntryRemoved .connect (boost::bind (&ConnectTrace::NotifyEntryRemoved, this , _1, _2));
2194
2194
}
2195
2195
@@ -2199,6 +2199,7 @@ class ConnectTrace {
2199
2199
2200
2200
void BlockConnected (CBlockIndex* pindex, std::shared_ptr<const CBlock> pblock) {
2201
2201
blocksConnected.emplace_back (pindex, std::move (pblock));
2202
+ conflictedTxs.emplace_back ();
2202
2203
}
2203
2204
2204
2205
std::vector<std::pair<CBlockIndex*, std::shared_ptr<const CBlock> > >& GetBlocksConnected () {
@@ -2207,15 +2208,18 @@ class ConnectTrace {
2207
2208
2208
2209
void NotifyEntryRemoved (CTransactionRef txRemoved, MemPoolRemovalReason reason) {
2209
2210
if (reason == MemPoolRemovalReason::CONFLICT) {
2210
- conflictedTxs.push_back (txRemoved);
2211
+ conflictedTxs.back (). push_back (txRemoved);
2211
2212
}
2212
2213
}
2213
2214
2214
2215
void CallSyncTransactionOnConflictedTransactions () {
2215
- for (const auto & tx : conflictedTxs) {
2216
- GetMainSignals ().SyncTransaction (*tx, NULL , CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
2216
+ for (const auto & txRemovedForBlock : conflictedTxs) {
2217
+ for (const auto & tx : txRemovedForBlock) {
2218
+ GetMainSignals ().SyncTransaction (*tx, NULL , CMainSignals::SYNC_TRANSACTION_NOT_IN_BLOCK);
2219
+ }
2217
2220
}
2218
2221
conflictedTxs.clear ();
2222
+ conflictedTxs.emplace_back ();
2219
2223
}
2220
2224
};
2221
2225
0 commit comments