bitcoin/bitcoin — pull request #2224 by sipa (2013-01-27 00:53:25+00:00)
Title: Improve error handling during validation

The goal of this pull request is improving how errors during block and transaction validation are propagated, displayed and handled.

It introduces CValidationState, which stores metadata about a block or transaction validation being performed. It is used to distinguish validation errors (failure to meet network rules, for example) with runtime errors (like out of disk space), as formerly these could be confused, leading to blocks being marked invalid because the disk space ran out. Additionally, CValidationState also takes over the role of tracking DoS levels (so it doesn't need to be stored inside transactions or blocks...).

Additionally, some extra checks are introduced, excessive coinbase values are made a DoSable offence, disk space is checked before trying to flush the coin case, and read/write errors cause a fatal error (reported to stdout/GUI, followed by shutdown).