If incoming connections are disabled, Max full-relay connections are 8: src/net.h#L64 and Max block-relay-only connections are 2: src/net.h#L68

How are these decided and how can a user change these values?

Its mentioned in doc/reduce-memory.md that each connection takes up some memory. What if the user is okay with it?

Will changing MAX_OUTBOUND_FULL_RELAY_CONNECTIONS to 32 or above help in faster sync? Or dbcache and par are the only options to improve sync?

I tried changing it to 40 but extra nodes keep disconnecting. I see this line in the logs src/net_processing.cpp#L4581 and not sure if its related to DoS protection or something else.


Update 1: I commented the if statement here: src/net_processing.cpp#L4577 Compiled successfully and tests passed. I could see more than 15 peers connected but sync almost paused after few minutes and nothing happened. Couldn't find anything useful in logs.


  • 1
    Number of connections is not the bottleneck for synchronization speed. Mar 22, 2021 at 10:35
  • Can changing number of connections affect IBD? How will it work with 1-2 peers and what will be the change with 20-30 peers. At least the downloading part if not verification
    – user103136
    Mar 22, 2021 at 12:13

1 Answer 1



Issue resolved. I was able to get 16 outgoing full relay connections that are stable using the below changes in code:

Adding below lines in src/init.cpp

argsman.AddArg("-maxoutfullrelay=<n>", strprintf("Maintain at most <n> outbound full relay connections to peers (default: %u)", MAX_OUTBOUND_FULL_RELAY_CONNECTIONS), ArgsManager::ALLOW_ANY, OptionsCategory::CONNECTION);

int nMaxOutboundFullRelay;

nMaxOutboundFullRelay = args.GetArg("-maxoutfullrelay", MAX_OUTBOUND_FULL_RELAY_CONNECTIONS);
nMaxOutboundFullRelay = std::max(nMaxOutboundFullRelay, 0);

connOptions.m_max_outbound_full_relay = std::min(nMaxOutboundFullRelay, connOptions.nMaxConnections);

And maxoutfullrelay=16 in bitcoin.conf. Tried with 20 as well and it works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy