aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-09-01 10:36:13 +0200
committerMacroFake <falke.marco@gmail.com>2022-09-01 10:37:00 +0200
commitfa5c224d444802dabec5841009e029b9754c92f1 (patch)
tree51a3e6c0ae48c8c7db0e247dda8c3495f2e92bc1 /src/init.cpp
parentccea0e11a210d8371fe3a914d83da61fbf7d558f (diff)
parent1b5bec78e942473b6ffac4004b1cf6d535fd2892 (diff)
downloadbitcoin-fa5c224d444802dabec5841009e029b9754c92f1.tar.xz
Merge bitcoin/bitcoin#25887: init: avoid unsetting service bits from `nLocalServices`
1b5bec78e942473b6ffac4004b1cf6d535fd2892 init: avoid unsetting service bits from `nLocalServices` (Sebastian Falbesoner) Pull request description: This PR is a late follow-up to the [review club session about the PR "Default to NODE_WITNESS in nLocalServices" ](https://bitcoincore.reviews/21090#l-90) (#21090): ``` 17:32 <lightlike> hmm, if we are in pruned mode, we first set NODE_NETWORK and then unset it later in init.cpp. that seems a bit strange. ... 17:33 <jnewbery> lightlike: ah yes, you're right. That does seem a bit messy. ``` Rather than setting the service bit `NODE_NETWORK` first and then unset it (if in `fPruneMode`), start with the bare minimum flags that we always serve and only add `NODE_NETWORK` if we are running as a non-pruned node. This seems to be a more logical approach than currently on master. ACKs for top commit: naumenkogs: ACK 1b5bec78e942473b6ffac4004b1cf6d535fd2892 stickies-v: ACK 1b5bec78e942473b6ffac4004b1cf6d535fd2892 LarryRuane: ACK 1b5bec78e942473b6ffac4004b1cf6d535fd2892 Tree-SHA512: 2e82d66c4298ffacff41d9e0458b74b83bc156a1fa49e3f3471e942878e5dd2b253b5597ee5ec1d9c8726b432751d05e40f0c580f3976a9e00a7d1f417921ab0
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 137d98026e..9d3a8e7f87 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