mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
BIP144: Handshake and relay (receiver side)
Service bit logic by Nicolas Dorier. Only download blocks from witness peers after fork.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user