bitcoin/bitcoin — pull request #4656 by rnicoll (2014-08-07 22:07:56+00:00)
Title: Close LevelDB cursor in case of an error loading blocks

Close LevelDB cursor in case of an error loading blocks. Otherwise an assertion error occurs when the database is deleted (around line 938 of init.cpp).

I don't have a simple test-case for this for Bitcoin, apologies; the problem occurs in Dogecoin 1.8 due to block length changes introduced for AuxPoW support, and this is effectively merging that change upstream.