diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2015-11-17 00:20:49 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2016-06-22 15:42:59 +0200 |
commit | b8a97498df1e83f8dcc49bc3fa4344f9e9799242 (patch) | |
tree | d14eb0cb55048583a5233b1ef25f25fb8d7651ab /src/net.cpp | |
parent | 8b49040854be2e26b66366aeae1cba4716f93d93 (diff) |
BIP144: Handshake and relay (receiver side)
Service bit logic by Nicolas Dorier.
Only download blocks from witness peers after fork.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index 336163a896..dc83f19be4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -72,7 +72,7 @@ namespace { const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*"; /** Services this node implementation cares about */ -static const ServiceFlags nRelevantServices = NODE_NETWORK; +ServiceFlags nRelevantServices = NODE_NETWORK; // // Global state variables @@ -1676,6 +1676,10 @@ void ThreadOpenConnections() if (nANow - addr.nLastTry < 600 && nTries < 30) continue; + // only consider nodes missing relevant services after 40 failed attemps + if ((addr.nServices & nRelevantServices) != nRelevantServices && nTries < 40) + continue; + // do not allow non-default ports, unless after 50 invalid addresses selected already if (addr.GetPort() != Params().GetDefaultPort() && nTries < 50) continue; |