| 738 | } |
| 739 | |
| 740 | void EraseOrphansFor(NodeId peer) |
| 741 | { |
| 742 | LOCK(g_cs_orphans); |
| 743 | int nErased = 0; |
| 744 | std::map<uint256, COrphanTx>::iterator iter = mapOrphanTransactions.begin(); |
| 745 | while (iter != mapOrphanTransactions.end()) |
| 746 | { |
| 747 | std::map<uint256, COrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid |
| 748 | if (maybeErase->second.fromPeer == peer) |
| 749 | { |
| 750 | nErased += EraseOrphanTx(maybeErase->second.tx->GetHash()); |
| 751 | } |
| 752 | } |
| 753 | if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer=%d\n", nErased, peer); |
| 754 | } |
| 755 | |
| 756 | |
| 757 | unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) |