HomePhabricator

Replace relevant services logic with a function suite.

Authored by Matt Corallo <git@bluematt.me> on Oct 4 2017, 21:59.

Description

Replace relevant services logic with a function suite.

Summary:
Adds HasAllRelevantServices and GetRelevantServices, which check
for NETWORK|WITNESS.

This changes the following:

  • Removes nRelevantServices from CConnman, disconnecting it a bit more from protocol-level logic.
  • This has the added benefit of removing nServicesExpected from CNode - instead letting net_processing's VERSION message handling simply check HasAllRelevantServices.
  • In order to prevent this change from preventing connection to -connect= nodes which do not have the require flags, -connect nodes are now given the "addnode" flag. This also allows outbound connections to !NODE_NETWORK nodes for -connect nodes (which was already true of addnodes).
  • Has the (somewhat unintended) consequence of changing one of the eviction metrics from the same metric to requiring HasRelevantServices.

This should make NODE_NETWORK_LIMITED much simpler to implement.

  • Rename fAddnode to a more-descriptive "manual_connection"
  • Clarify docs for requirements/handling of addnode/connect nodes
  • Switch DNSSeed-needed metric to any-automatic-nodes, not services

This is a backport of core PR11456

Test Plan:

make check

Reviewers: #bitcoin_abc, schancel

Reviewed By: #bitcoin_abc, schancel

Subscribers: schancel, teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1760

Details

Committed
deadalnixSep 12 2018, 00:00
Pushed
deadalnixSep 12 2018, 00:00
Reviewer
Restricted Project
Differential Revision
D1760: Replace relevant services logic with a function suite.
Parents
rABC82ae5d0db7e4: net: avoid extra dns query per seed
Branches
Unknown
Tags
Unknown

Event Timeline