aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2022-08-20 14:18:42 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2022-08-20 22:36:27 +0200
commit1b5bec78e942473b6ffac4004b1cf6d535fd2892 (patch)
treefa3a539a76408a7bf88d0425ae754abd92474af6 /src/init.cpp
parentc73c8d53fe27956faacb3e8ca0e94adf071de6ec (diff)
downloadbitcoin-1b5bec78e942473b6ffac4004b1cf6d535fd2892.tar.xz
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.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 480b8c7705..bd3e10421f 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -742,7 +742,7 @@ namespace { // Variables internal to initialization process only
int nMaxConnections;
int nUserMaxConnections;
int nFD;
-ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK | NODE_NETWORK_LIMITED | NODE_WITNESS);
+ServiceFlags nLocalServices = ServiceFlags(NODE_NETWORK_LIMITED | NODE_WITNESS);
int64_t peer_connect_timeout;
std::set<BlockFilterType> g_enabled_filter_types;
@@ -1519,11 +1519,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// ********************************************************* Step 10: data directory maintenance
- // if pruning, unset the service bit and perform the initial blockstore prune
+ // if pruning, perform the initial blockstore prune
// after any wallet rescanning has taken place.
if (fPruneMode) {
- LogPrintf("Unsetting NODE_NETWORK on prune mode\n");
- nLocalServices = ServiceFlags(nLocalServices & ~NODE_NETWORK);
if (!fReindex) {
LOCK(cs_main);
for (CChainState* chainstate : chainman.GetAll()) {
@@ -1531,6 +1529,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
chainstate->PruneAndFlush();
}
}
+ } else {
+ LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
+ nLocalServices = ServiceFlags(nLocalServices | NODE_NETWORK);
}
// ********************************************************* Step 11: import blocks