Skip to content

Commit 1b5bec7

Browse files
committed
init: avoid unsetting service bits from nLocalServices
Rather than setting the service bit `NODE_NETWORK` first and then unset it, start out the bare minimum flags that every node serves and only add `NODE_NETWORK` if we are running as a non-pruned node.
1 parent c73c8d5 commit 1b5bec7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/init.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ namespace { // Variables internal to initialization process only
742742
int nMaxConnections;
743743
int nUserMaxConnections;
744744
int nFD;
745-
ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK | NODE_NETWORK_LIMITED | NODE_WITNESS);
745+
ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK_LIMITED | NODE_WITNESS);
746746
int64_t peer_connect_timeout;
747747
std::set<BlockFilterType> g_enabled_filter_types;
748748

@@ -1519,18 +1519,19 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
15191519

15201520
// ********************************************************* Step 10: data directory maintenance
15211521

1522-
// if pruning, unset the service bit and perform the initial blockstore prune
1522+
// if pruning, perform the initial blockstore prune
15231523
// after any wallet rescanning has taken place.
15241524
if (fPruneMode) {
1525-
LogPrintf("Unsetting NODE_NETWORK on prune mode\n");
1526-
nLocalServices = ServiceFlags(nLocalServices & ~NODE_NETWORK);
15271525
if (!fReindex) {
15281526
LOCK(cs_main);
15291527
for (CChainState* chainstate : chainman.GetAll()) {
15301528
uiInterface.InitMessage(_("Pruning blockstore…").translated);
15311529
chainstate->PruneAndFlush();
15321530
}
15331531
}
1532+
} else {
1533+
LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
1534+
nLocalServices = ServiceFlags(nLocalServices | NODE_NETWORK);
15341535
}
15351536

15361537
// ********************************************************* Step 11: import blocks

0 commit comments

Comments
 (0)