Commit Graph

20 Commits

Author SHA1 Message Date
tomFlowee ceb44cc3b5 Remove dead code. 2021-02-05 17:26:40 +01:00
tomFlowee 1f2f7c36d2 Port the boost container to the std one.
The unordered_map is now available in stl, and said to be better,
so lets slowly switch over
2021-02-03 16:31:46 +01:00
tomFlowee 5d6d09e4d6 Assign segments only to good peers
Instead of assigning a privacy segment at connect, wait until we have
determined if this peer is on the same chain as us before we allocate a
peer slot.

This also helps us limit the amount of peers we send our bloom filter to.
2021-02-03 14:41:51 +01:00
tomFlowee adfe4081cb Update copyright notice and email address 2021-02-02 13:08:07 +01:00
TomZ 93148976e9 add the checkpoint to p2pnet 2020-11-15 15:27:32 +01:00
TomZ 37e1f2fcd3 Fix bad usage of create_directories() 2020-11-14 23:59:01 +01:00
TomZ 301a4ca3ee Fix properly following the chain-tip
This is done in several steps:

1. Separate my height from the remote peer heights.
Instead of assuming we have one height, recognize that a peer may
not be at the tip at the same time we are. We monitor headers/invs
to update the 'peerHeight' variable.

2. Ask for merkle blocks from a peer to the maximum height of that
peer (but not later than what we validated to be true).
This avoids us asking past the remotes tip which they didn't like.

3. Redo the SyncSPVAction to use all this and make it much more
reliable in finding peers to download from and getting all the
changes as fast as possible.
2020-11-13 21:03:56 +01:00
TomZ 062f62af67 Bugfixes 2020-11-05 21:49:32 +01:00
TomZ e8a2996c84 Persist succesful 'headers' call.
This fixes the issue that a headers call did not get remembered when we
were up-to-date.
2020-11-05 21:48:57 +01:00
TomZ 3f5fe41534 P2PNet: Support multiple chains.
This adds support for the testnet4 chain.
2020-10-29 21:47:53 +01:00
TomZ b89d117475 Add checkpoints after latest protcol upgrade 2020-05-15 17:14:46 +02:00
TomZ ef69014fd2 Upgrade log line 2020-05-13 22:29:23 +02:00
TomZ 2341e4723e P2PNet Make logs easier to read 2020-05-11 20:01:07 +02:00
TomZ 7bfe5e0e2c Provide a getter for blockHeight on Blockchain 2020-05-11 18:07:10 +02:00
TomZ d0bc12ea2d API docs and minor fixes 2020-05-11 17:42:44 +02:00
TomZ 43d7626d46 P2PNet make the blockchain class save its state. 2020-05-11 15:16:59 +02:00
TomZ 010df674e4 P2PNet: Use exceptions and avoid deadlock.
This avoids still having the blockchain lock while calling into the
connectionmanager which may do the reverse, causing deadlock.
2020-05-10 16:02:14 +02:00
TomZ ebbbdcd3a2 P2PNet: log improvement.
Also fix cron disconnecting peers before they connect.
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 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