mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
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.
This commit is contained in:
@@ -742,7 +742,7 @@ namespace { // Variables internal to initialization process only
|
|||||||
int nMaxConnections;
|
int nMaxConnections;
|
||||||
int nUserMaxConnections;
|
int nUserMaxConnections;
|
||||||
int nFD;
|
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;
|
int64_t peer_connect_timeout;
|
||||||
std::set<BlockFilterType> g_enabled_filter_types;
|
std::set<BlockFilterType> g_enabled_filter_types;
|
||||||
|
|
||||||
@@ -1519,11 +1519,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
|
|
||||||
// ********************************************************* Step 10: data directory maintenance
|
// ********************************************************* 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.
|
// after any wallet rescanning has taken place.
|
||||||
if (fPruneMode) {
|
if (fPruneMode) {
|
||||||
LogPrintf("Unsetting NODE_NETWORK on prune mode\n");
|
|
||||||
nLocalServices = ServiceFlags(nLocalServices & ~NODE_NETWORK);
|
|
||||||
if (!fReindex) {
|
if (!fReindex) {
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
for (CChainState* chainstate : chainman.GetAll()) {
|
for (CChainState* chainstate : chainman.GetAll()) {
|
||||||
@@ -1531,6 +1529,9 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||||||
chainstate->PruneAndFlush();
|
chainstate->PruneAndFlush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
|
||||||
|
nLocalServices = ServiceFlags(nLocalServices | NODE_NETWORK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ********************************************************* Step 11: import blocks
|
// ********************************************************* Step 11: import blocks
|
||||||
|
|||||||
Reference in New Issue
Block a user