fixed difficulty transition code by mirroring more closely main.cpp in the satoshi client (for real)