koinos / koinos-p2p

The p2p microservice orchestrates the distribution of blocks and transactions between peers.
MIT License
6 stars 4 forks source link

Batch checkpoint checking #160

Closed theoreticalbts closed 2 years ago

theoreticalbts commented 2 years ago

As summarized in this TODO, we should batch request checkpoint blocks.

The comment's text is somewhat outdated (its specific suggestion about unnecessary blocks in particular refers to a previous version of the code, before this commit changed from using GetBlocks to GetTopologyAtHeight).

Although some of the details in the comment are obsolete, it's broadly correct in that the API isn't quite right:

[1] The current code requests blocks on all forks. It only rejects the peer if the peer has at least one block at the checkpoint height, and none of the blocks it has match the checkpoint ID. (This check is repeated for each checkpoint.)

sgerbino commented 2 years ago

We'll have to readdress this in the P2P rearchitecture.