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:
Pieter Wuille
2015-11-17 00:20:49 +01:00
parent 8b49040854
commit b8a97498df
6 changed files with 60 additions and 9 deletions

View File

@@ -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;