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
Test Plan:
make check
Reviewers: #bitcoin_abc, schancel
Reviewed By: #bitcoin_abc, schancel
Subscribers: schancel, teamcity
Differential Revision: https://reviews.bitcoinabc.org/D1780