Skip to content

Commit b3f0a34

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25119: net, refactor: move StartExtraBlockRelayPeers() from header to implementation
51ec96b refactor: move StartExtraBlockRelayPeers from header to implementation (Jon Atack) Pull request description: where all the other logging actions in src/net.{h,cpp} are located. StartExtraBlockRelayPeers() does not appear to be a hotspot that needs to be inlined for performance, as it is called from CheckForStaleTipAndEvictPeers(), called in turn from StartScheduledTasks() with a scheduleEvery delta of 45 seconds, called at the end of AppInitMain() on bitcoind startup. This allows dropping `#include <logging.h>` from net.h, which can improve compile time/speed. Currently, none of the other includes in net.h use logging.h, except src/sync.h if DEBUG_LOCKCONTENTION is defined. ACKs for top commit: LarryRuane: ACK 51ec96b theStack: ACK 51ec96b Tree-SHA512: 69b2c09163c48bfcb43355af0aa52ee7dd81efc755a7aa6a10f5e400b5e14109484437960a62a1cfac2524c2cfae981fee082846b19526b540ef5b86be97f0fe
2 parents fe1fcdc + 51ec96b commit b3f0a34

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/net.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,12 @@ void CConnman::SetTryNewOutboundPeer(bool flag)
18671867
LogPrint(BCLog::NET, "net: setting try another outbound peer=%s\n", flag ? "true" : "false");
18681868
}
18691869

1870+
void CConnman::StartExtraBlockRelayPeers()
1871+
{
1872+
LogPrint(BCLog::NET, "net: enabling extra block-relay-only peers\n");
1873+
m_start_extra_block_relay_peers = true;
1874+
}
1875+
18701876
// Return the number of peers we have over our outbound connection limit
18711877
// Exclude peers that are marked for disconnect, or are going to be
18721878
// disconnected soon (eg ADDR_FETCH and FEELER)

src/net.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <crypto/siphash.h>
1414
#include <hash.h>
1515
#include <i2p.h>
16-
#include <logging.h>
1716
#include <net_permissions.h>
1817
#include <netaddress.h>
1918
#include <netbase.h>
@@ -857,10 +856,7 @@ class CConnman
857856
void SetTryNewOutboundPeer(bool flag);
858857
bool GetTryNewOutboundPeer() const;
859858

860-
void StartExtraBlockRelayPeers() {
861-
LogPrint(BCLog::NET, "net: enabling extra block-relay-only peers\n");
862-
m_start_extra_block_relay_peers = true;
863-
}
859+
void StartExtraBlockRelayPeers();
864860

865861
// Return the number of outbound peers we have in excess of our target (eg,
866862
// if we previously called SetTryNewOutboundPeer(true), and have since set

0 commit comments

Comments
 (0)