Bitcoin client downloads blocks from different peers When a bitcoin client downloads blocks from different peers, how does it determine the number of blocks to download from which peer?
Since Bitcoin Core 0.10, the following mechanism is used:


We start off by asking peers for their best headers, and thus learn the most-work chain's headers quickly, and which peers have which parts of it available.
In the background, we continually ask peers for their blocks, in sequential height order, under the following conditions:


If a block is already asked from another peer, we don't ask for it again.
If a peer's known best block's corresponding chain has less total work than our currently active (fully downloaded and validated and accepted) chain, we ignore that peer - they'd only get us onto a fork that's worse than what we have.
If the only available blocks from a given peers that aren't already being downloaded already, are more than 1024 blocks ahead of our currently active chain, we don't ask anything (more) from that peer.
If there are already 16 or more blocks in transit from a given peer, we don't ask any more blocks from that peer.



All of this is subject to various timeout rules. In particular, when we're waiting for blocks from a single peer before we can download more from everyone else (because every other block in the 1024 that succeed our active chain is already downloaded), we disconnect that peer, and mark all its in flight blocks are available for fetching again from others.