MCPcopy Create free account
hub / github.com/ElementsProject/elements / EraseForPeer

Method EraseForPeer

src/txorphanage.cpp:88–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void TxOrphanage::EraseForPeer(NodeId peer)
89{
90 AssertLockHeld(g_cs_orphans);
91
92 int nErased = 0;
93 std::map<uint256, OrphanTx>::iterator iter = m_orphans.begin();
94 while (iter != m_orphans.end())
95 {
96 std::map<uint256, OrphanTx>::iterator maybeErase = iter++; // increment to avoid iterator becoming invalid
97 if (maybeErase->second.fromPeer == peer)
98 {
99 nErased += EraseTx(maybeErase->second.tx->GetHash());
100 }
101 }
102 if (nErased > 0) LogPrint(BCLog::MEMPOOL, "Erased %d orphan tx from peer=%d\n", nErased, peer);
103}
104
105unsigned int TxOrphanage::LimitOrphans(unsigned int max_orphans)
106{

Callers 2

FinalizeNodeMethod · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 3

beginMethod · 0.45
endMethod · 0.45
GetHashMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64