Skip to content

Commit 33381ea

Browse files
committed
scripted-diff: Modernize nLocalServices to m_local_services
-BEGIN VERIFY SCRIPT- sed -i 's/nLocalServices/m_local_services/g' src/net.h src/net.cpp sed -i 's/connOptions.nLocalServices/connOptions.m_local_services/g' src/init.cpp sed -i 's/nLocalServices/g_local_services/g' src/init.cpp -END VERIFY SCRIPT-
1 parent a5e9966 commit 33381ea

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/init.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ namespace { // Variables internal to initialization process only
840840

841841
int nMaxConnections;
842842
int available_fds;
843-
ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK_LIMITED | NODE_WITNESS);
843+
ServiceFlags g_local_services = ServiceFlags(NODE_NETWORK_LIMITED | NODE_WITNESS);
844844
int64_t peer_connect_timeout;
845845
std::set<BlockFilterType> g_enabled_filter_types;
846846

@@ -955,7 +955,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
955955

956956
// Signal NODE_P2P_V2 if BIP324 v2 transport is enabled.
957957
if (args.GetBoolArg("-v2transport", DEFAULT_V2_TRANSPORT)) {
958-
nLocalServices = ServiceFlags(nLocalServices | NODE_P2P_V2);
958+
g_local_services = ServiceFlags(g_local_services | NODE_P2P_V2);
959959
}
960960

961961
// Signal NODE_COMPACT_FILTERS if peerblockfilters and basic filters index are both enabled.
@@ -964,7 +964,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
964964
return InitError(_("Cannot set -peerblockfilters without -blockfilterindex."));
965965
}
966966

967-
nLocalServices = ServiceFlags(nLocalServices | NODE_COMPACT_FILTERS);
967+
g_local_services = ServiceFlags(g_local_services | NODE_COMPACT_FILTERS);
968968
}
969969

970970
if (args.GetIntArg("-prune", 0)) {
@@ -1049,7 +1049,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
10491049
SetMockTime(args.GetIntArg("-mocktime", 0)); // SetMockTime(0) is a no-op
10501050

10511051
if (args.GetBoolArg("-peerbloomfilters", DEFAULT_PEERBLOOMFILTERS))
1052-
nLocalServices = ServiceFlags(nLocalServices | NODE_BLOOM);
1052+
g_local_services = ServiceFlags(g_local_services | NODE_BLOOM);
10531053

10541054
if (args.IsArgSet("-test")) {
10551055
if (chainparams.GetChainType() != ChainType::REGTEST) {
@@ -1724,7 +1724,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
17241724
// Prior to setting NODE_NETWORK, check if we can provide historical blocks.
17251725
if (!WITH_LOCK(chainman.GetMutex(), return chainman.BackgroundSyncInProgress())) {
17261726
LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
1727-
nLocalServices = ServiceFlags(nLocalServices | NODE_NETWORK);
1727+
g_local_services = ServiceFlags(g_local_services | NODE_NETWORK);
17281728
} else {
17291729
LogPrintf("Running node in NODE_NETWORK_LIMITED mode until snapshot background sync completes\n");
17301730
}
@@ -1856,7 +1856,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
18561856
StartMapPort(args.GetBoolArg("-upnp", DEFAULT_UPNP), args.GetBoolArg("-natpmp", DEFAULT_NATPMP));
18571857

18581858
CConnman::Options connOptions;
1859-
connOptions.nLocalServices = nLocalServices;
1859+
connOptions.m_local_services = g_local_services;
18601860
connOptions.m_max_automatic_connections = nMaxConnections;
18611861
connOptions.uiInterface = &uiInterface;
18621862
connOptions.m_banman = node.banman.get();

src/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2945,7 +2945,7 @@ void CConnman::OpenNetworkConnection(const CAddress& addrConnect, bool fCountFai
29452945
return;
29462946
pnode->grantOutbound = std::move(grant_outbound);
29472947

2948-
m_msgproc->InitializeNode(*pnode, nLocalServices);
2948+
m_msgproc->InitializeNode(*pnode, m_local_services);
29492949
{
29502950
LOCK(m_nodes_mutex);
29512951
m_nodes.push_back(pnode);
@@ -3742,7 +3742,7 @@ uint64_t CConnman::GetTotalBytesSent() const
37423742

37433743
ServiceFlags CConnman::GetLocalServices() const
37443744
{
3745-
return nLocalServices;
3745+
return m_local_services;
37463746
}
37473747

37483748
static std::unique_ptr<Transport> MakeTransport(NodeId id, bool use_v2transport, bool inbound) noexcept

src/net.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ class CConnman
10351035

10361036
struct Options
10371037
{
1038-
ServiceFlags nLocalServices = NODE_NONE;
1038+
ServiceFlags m_local_services = NODE_NONE;
10391039
int m_max_automatic_connections = 0;
10401040
CClientUIInterface* uiInterface = nullptr;
10411041
NetEventsInterface* m_msgproc = nullptr;
@@ -1065,7 +1065,7 @@ class CConnman
10651065
{
10661066
AssertLockNotHeld(m_total_bytes_sent_mutex);
10671067

1068-
nLocalServices = connOptions.nLocalServices;
1068+
m_local_services = connOptions.m_local_services;
10691069
m_max_automatic_connections = connOptions.m_max_automatic_connections;
10701070
m_max_outbound_full_relay = std::min(MAX_OUTBOUND_FULL_RELAY_CONNECTIONS, m_max_automatic_connections);
10711071
m_max_outbound_block_relay = std::min(MAX_BLOCK_RELAY_ONLY_CONNECTIONS, m_max_automatic_connections - m_max_outbound_full_relay);
@@ -1223,8 +1223,8 @@ class CConnman
12231223

12241224
//! Updates the local services that this node advertises to other peers
12251225
//! during connection handshake.
1226-
void AddLocalServices(ServiceFlags services) { nLocalServices = ServiceFlags(nLocalServices | services); };
1227-
void RemoveLocalServices(ServiceFlags services) { nLocalServices = ServiceFlags(nLocalServices & ~services); }
1226+
void AddLocalServices(ServiceFlags services) { m_local_services = ServiceFlags(m_local_services | services); };
1227+
void RemoveLocalServices(ServiceFlags services) { m_local_services = ServiceFlags(m_local_services & ~services); }
12281228

12291229
uint64_t GetMaxOutboundTarget() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
12301230
std::chrono::seconds GetMaxOutboundTimeframe() const;
@@ -1470,7 +1470,7 @@ class CConnman
14701470
*
14711471
* \sa Peer::our_services
14721472
*/
1473-
std::atomic<ServiceFlags> nLocalServices;
1473+
std::atomic<ServiceFlags> m_local_services;
14741474

14751475
std::unique_ptr<CSemaphore> semOutbound;
14761476
std::unique_ptr<CSemaphore> semAddnode;

0 commit comments

Comments
 (0)