bitcoin/bitcoin — pull request #3370 by sipa (2013-12-08 19:36:16+00:00)
Title: Prepare block connection logic for headers-first

This is a preparation for headers-first, which is on itself useful, but doesn't change the downloading or verification semantics yet.

It does change how the block connection logic works: it always makes sure the oldest valid chain with most work is connected. Instead of doing a "connect the received block now" atomically during process of that block, there is just a generic loop that disconnects and connects block to aim for the assumed best chain - reverting if necessary.

Let's see if pulltester likes this...