0

I've been thinking about this for a while and can't seem to understand part of the network.

Lets assume that I'm a node that has been offline for 5 months and I want to retrieve the new blocks. When I broadcast the getblocks message different nodes see it, do all of my peers respond or do some of them respond and the others ignore it because of the other responses? And if they all respond back, would my node then choose which one/ones it wants to get the data from, or would it get the data from all of them? If it gets the data from all of them then wouldn't that slow the system down a lot and create a lot more traffic on the network?

0

A node does not know about the other nodes that one of their peers are connected to. They will respond with whatever your node requests from them, even if this ends up being duplicate blocks.

Because network connections are direct streams, your node knows exactly what it has sent and received to and from each of its peers. So your node will choose the peers it wants to download blocks from and send them specific requests for those blocks. Since Bitcoin Core uses headers first sync, there is no need to just send a getblocks message; instead it can use getdata messages to request specific blocks and spread out the download over multiple peers.

In previous versions of Bitcoin Core, it would choose one node to sync off of and download all of the blocks from just that node. However this behavior is no longer done, although it is still part of the protocol and can still be done.

  • So it basically gets the responses from all of the other nodes and then processes them into a chain for itself? Wouldn't that cause a lot of traffic? – agah ebrahimi Apr 12 '18 at 19:36
  • No, it does not cause a lot of traffic. There are not duplicate responses from each node because your node ensures that there are no duplicates by not requesting the same data from different nodes. – Andrew Chow Apr 12 '18 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.