HomePhabricator

Connect to a new outbound peer if our tip is stale

Description

Connect to a new outbound peer if our tip is stale

Summary:

  • net: Allow connecting to extra outbound peers
  • Track tip update time and last new block announcement from each peer
  • Add CConnmanTest to mutate g_connman in tests
  • Connect to an extra outbound peer if our tip is stale

If our tip hasn't updated in a while, that may be because our peers are
not relaying blocks to us that we would consider valid. Allow connection
to an additional outbound peer in that circumstance.

Also, periodically check to see if we are exceeding our target number of
outbound peers, and disconnect the one which has least recently
announced a new block to us (choosing the newest such peer in the case
of tie).

  • Add scheduler to the testing setup
  • Add unit test for stale tip checking

This is a backport of core PR11560

Depends on D1778 and D1776

Test Plan:

make check

Reviewers: #bitcoin_abc, schancel

Reviewed By: #bitcoin_abc, schancel

Subscribers: schancel, teamcity

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

Details

Provenance
Suhas Daftuar <sdaftuar@gmail.com>Authored on Oct 23 2017, 17:36
deadalnixCommitted on Sep 18 2018, 04:33
jasonbcoxPushed on Sep 18 2018, 16:35
Reviewer
Restricted Project
Differential Revision
D1780: Connect to a new outbound peer if our tip is stale
Parents
rSTAGING1406dd76d92b: Backport all changes related to checkqueue.h and its test from Core
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/4970, tag: phabricator/base/4963