| 261 | } |
| 262 | |
| 263 | void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) |
| 264 | { |
| 265 | // We increment mempool sequence value no matter removal reason |
| 266 | // even if not directly reported below. |
| 267 | uint64_t mempool_sequence = GetAndIncrementSequence(); |
| 268 | |
| 269 | if (reason != MemPoolRemovalReason::BLOCK && m_opts.signals) { |
| 270 | // Notify clients that a transaction has been removed from the mempool |
| 271 | // for any reason except being included in a block. Clients interested |
| 272 | // in transactions included in blocks can subscribe to the BlockConnected |
| 273 | // notification. |
| 274 | m_opts.signals->TransactionRemovedFromMempool(it->GetSharedTx(), reason, mempool_sequence); |
| 275 | } |
| 276 | TRACEPOINT(mempool, removed, |
| 277 | it->GetTx().GetHash().data(), |
| 278 | RemovalReasonToString(reason).c_str(), |
| 279 | it->GetTxSize(), |
| 280 | it->GetFee(), |
| 281 | std::chrono::duration_cast<std::chrono::duration<std::uint64_t>>(it->GetTime()).count() |
| 282 | ); |
| 283 | |
| 284 | for (const CTxIn& txin : it->GetTx().vin) |
| 285 | mapNextTx.erase(txin.prevout); |
| 286 | |
| 287 | RemoveUnbroadcastTx(it->GetTx().GetHash(), true /* add logging because unchecked */); |
| 288 | |
| 289 | if (txns_randomized.size() > 1) { |
| 290 | // Remove entry from txns_randomized by replacing it with the back and deleting the back. |
| 291 | txns_randomized[it->idx_randomized] = std::move(txns_randomized.back()); |
| 292 | txns_randomized[it->idx_randomized].second->idx_randomized = it->idx_randomized; |
| 293 | txns_randomized.pop_back(); |
| 294 | if (txns_randomized.size() * 2 < txns_randomized.capacity()) { |
| 295 | txns_randomized.shrink_to_fit(); |
| 296 | } |
| 297 | } else { |
| 298 | txns_randomized.clear(); |
| 299 | } |
| 300 | |
| 301 | totalTxSize -= it->GetTxSize(); |
| 302 | m_total_fee -= it->GetFee(); |
| 303 | cachedInnerUsage -= it->DynamicMemoryUsage(); |
| 304 | mapTx.erase(it); |
| 305 | nTransactionsUpdated++; |
| 306 | } |
| 307 | |
| 308 | // Calculates descendants of given entry and adds to setDescendants. |
| 309 | void CTxMemPool::CalculateDescendants(txiter entryit, setEntries& setDescendants) const |
nothing calls this directly
no test coverage detected