Changeset View
Changeset View
Standalone View
Standalone View
src/kernel/disconnected_transactions.cpp
| Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | void DisconnectedBlockTransactions::importMempool(CTxMemPool &pool) { | ||||
| txInfo.reserve(pool.mapTx.size()); | txInfo.reserve(pool.mapTx.size()); | ||||
| for (const CTxMemPoolEntryRef &e : pool.mapTx.get<entry_id>()) { | for (const CTxMemPoolEntryRef &e : pool.mapTx.get<entry_id>()) { | ||||
| vtx.push_back(e->GetSharedTx()); | vtx.push_back(e->GetSharedTx()); | ||||
| // save entry time, feeDelta, and height for use in | // save entry time, feeDelta, and height for use in | ||||
| // updateMempoolForReorg() | // updateMempoolForReorg() | ||||
| txInfo.try_emplace(e->GetTx().GetId(), e->GetTime(), | txInfo.try_emplace(e->GetTx().GetId(), e->GetTime(), | ||||
| e->GetModifiedFee() - e->GetFee(), e->GetHeight()); | e->GetModifiedFee() - e->GetFee(), e->GetHeight()); | ||||
| } | } | ||||
| if (pool.m_signals) { | if (pool.m_opts.signals) { | ||||
| for (const CTxMemPoolEntryRef &e : | for (const CTxMemPoolEntryRef &e : | ||||
| reverse_iterate(pool.mapTx.get<entry_id>())) { | reverse_iterate(pool.mapTx.get<entry_id>())) { | ||||
| // Notify all observers of this (possibly temporary) removal. This | // Notify all observers of this (possibly temporary) removal. This | ||||
| // is necessary for tracking the transactions that are removed from | // is necessary for tracking the transactions that are removed from | ||||
| // the mempool during a reorg and can't be added back due to missing | // the mempool during a reorg and can't be added back due to missing | ||||
| // parent. Transactions that are added back to the mempool will | // parent. Transactions that are added back to the mempool will | ||||
| // trigger another notification. Make sure to notify in reverse | // trigger another notification. Make sure to notify in reverse | ||||
| // topological order, children first. | // topological order, children first. | ||||
| pool.m_signals->TransactionRemovedFromMempool( | pool.m_opts.signals->TransactionRemovedFromMempool( | ||||
| e->GetSharedTx(), MemPoolRemovalReason::REORG, | e->GetSharedTx(), MemPoolRemovalReason::REORG, | ||||
| pool.GetAndIncrementSequence()); | pool.GetAndIncrementSequence()); | ||||
| } | } | ||||
| } | } | ||||
| pool.clear(); | pool.clear(); | ||||
| // Use addForBlocks to sort the transactions and then splice them in front | // Use addForBlocks to sort the transactions and then splice them in front | ||||
| // of queuedTx | // of queuedTx | ||||
| ▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines | |||||