Regarding the "Mac Corruption Bug" as discussed here:
https://bitcointalk.org/index.php?topic=337294
I noticed a number of people quoting this kind of error:
Assertion failed: (pindexFirst), function GetNextWorkRequired, file ../litecoin/src/main.cpp, line 1149.
The relevant code in Bitcoin is in src/main.cpp:1026 (as of commit d980f9b7d687a1e60eecf3691b592d9806a30f4a):
// Go back by what we want to be 14 days worth of blocks
const CBlockIndex* pindexFirst = pindexLast;
for (int i = 0; pindexFirst && i < nInterval-1; i++)
pindexFirst = pindexFirst->pprev;
assert(pindexFirst);
I assume that the error is due to the # of pindexFirst->pprev links being less than nInterval-1. In that scenario, this code would walk pindexFirst all the way back until pprev is NULL. The code then is faulty in that it is overstepping the walking back of pindexFirst by one. Recommended code fix is to change the test as below:
// Go back by what we want to be 14 days worth of blocks
const CBlockIndex* pindexFirst = pindexLast;
for (int i = 0; pindexFirst->pprev && i < nInterval-1; i++)
pindexFirst = pindexFirst->pprev;
assert(pindexFirst);
The check for pindexLast being NULL is done in line 1031, so we are safe to check pindexFirst->pprev.
laanwj: edited title, as this is not about the mac corruption bug