Commit Graph

17 Commits

Author SHA1 Message Date
tomFlowee 678eccfa70 Be smarter at asking for 'headers' from peers 2024-01-04 21:53:16 +01:00
tomFlowee 141553ce6e Improve stale getheaders peer detection
This improves several corner cases on detecting if a peer we
are requesting headers from is actually giving them to us.

Specifically, the height could be zero for a genesis-only view, which
caused the detection to always give the higest score (height zero is
seen as special).

After a node is disconnected we now also reset the history in order to
let the new node get measured from only its own performance.
2023-11-03 22:12:02 +01:00
tomFlowee 153f72b5ac Debug output tweaks 2023-04-17 19:25:07 +02:00
tomFlowee 2c0e0bad75 Update SyncChainAction to present day concepts
When the SyncChainAction was written, various interactions we do
today in the ConnectionManager did not happen yet. Features in
Peer didn't exist yet.

This updates the SyncChainAction to take those items into account
and be more responsive and conclue we are 'up to date' faster,
while also leaving behind a better state.
2023-03-27 15:20:50 +02:00
tomFlowee 79ea54183e fixes in comments. 2023-03-25 17:26:24 +01:00
tomFlowee 6c8263f50f Add comment. 2022-11-04 11:50:49 +01:00
tomFlowee adfe4081cb Update copyright notice and email address 2021-02-02 13:08:07 +01:00
TomZ 2b7ae939cf Simplify the syncchain action. 2020-11-13 21:03:56 +01:00
TomZ 5e48d0dae7 Be smarter about when to ask for headers.
This avoids us asking a bunch of peers the headers while we are not yet
at the tip.
2020-11-05 21:54:33 +01:00
TomZ 9397ab54e6 Accept less peers for non-mainnet chains. 2020-11-05 17:42:51 +01:00
TomZ 376fe9dc86 On startup, start downloading headers
In most cases headers would be automatically downloaded if we didn't
connect to that peer for a while, but that is not a guarentee so lets
make sure we actually start downloading headers from any peer we can :)
2020-10-29 22:18:10 +01:00
TomZ 148f9c0e93 Improve tracking of 'good' peers.
This avoids a peer once sending acceptable headers and never
being bothered again. Instead we now check regularly and keep
track of when the peer was known to follow the same chain as us.
2020-05-11 18:49:16 +02:00
TomZ 36cd1d4f56 Just disconnect a slow peer, don't ban. 2020-05-10 16:02:14 +02:00
TomZ d49b1ae5e2 Make NetworkManager connections leaner
The NetworkManager usage was mostly for low connection counts and this
made defaults selection easy.
With more usages it is important to allow the NWM-connection to be more
configurable about memory usage and leaner in general.

This changes the headers-buffers (used to create envelopes) to not be per
connection anymore but per thread using the tread_local keyword.

This changes the ring-buffers to become configurable using
NetworkConnections::setMessageQueueSizes().

Also removing some include statements where they were not really needed
in the P2PNet lib.
2020-05-09 20:23:05 +02:00
TomZ 3f60c0a48f remember 'good headers' flag for a peerAddress 2020-05-05 17:02:10 +02:00
TomZ 6e10b8d435 P2PNet: Fixes and some new methods 2020-04-26 16:20:45 +02:00
TomZ 25ffc84f80 Introduce new lib p2p
We reuse the NetworkManager lower level code in order to connect
to the Bitcoin P2P network.
This implements the basics for anyone wanting to be a player on
this network.
2020-04-20 21:49:03 +02:00