bitcoin/bitcoin — pull request #5463 by ajweiss (2014-12-11 21:05:41+00:00)
Title: Steady state block download timeouts

Once we're BLOCK_DOWNLOAD_WINDOW (1024) blocks from a peer's tip,
stalled peer detection for IBD finishes. Add a 2x block interval (20m)
download timeout that will only trigger when we're at this stage and
another peer is not transferring any blocks (a heuristic for whether or
not we're in a busy download state where we're starved for bandwidth).
In the event of a timeout trigger, re-request blocks elsewhere and apply
a small ban penalty.

This prevents lame or malicious peers from stalling synchronization
either during the final synchronization stage or during steady state
block relays.