MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / OutboundTargetReached

Method OutboundTargetReached

src/net.cpp:3992–4011  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3990}
3991
3992bool CConnman::OutboundTargetReached(bool historicalBlockServingLimit) const
3993{
3994 AssertLockNotHeld(m_total_bytes_sent_mutex);
3995 LOCK(m_total_bytes_sent_mutex);
3996 if (nMaxOutboundLimit == 0)
3997 return false;
3998
3999 if (historicalBlockServingLimit)
4000 {
4001 // keep a large enough buffer to at least relay each block once
4002 const std::chrono::seconds timeLeftInCycle = GetMaxOutboundTimeLeftInCycle_();
4003 const uint64_t buffer = timeLeftInCycle / std::chrono::minutes{10} * MAX_BLOCK_SERIALIZED_SIZE;
4004 if (buffer >= nMaxOutboundLimit || nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit - buffer)
4005 return true;
4006 }
4007 else if (nMaxOutboundTotalBytesSentInCycle >= nMaxOutboundLimit)
4008 return true;
4009
4010 return false;
4011}
4012
4013uint64_t CConnman::GetOutboundTargetBytesLeft() const
4014{

Callers 4

ProcessGetBlockDataMethod · 0.80
ProcessMessageMethod · 0.80
connman.cppFile · 0.80
getnettotalsFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected