namecoin/namecoin — pull request #68 by domob1812 (2014-04-14 09:55:02+00:00)
Title: Remove auxpow from blkindex.dat

This patch updates the blkindex.dat storage format for CBlockIndex objects to not include the auxpow. Instead, only a flag is saved, whether or not an auxpow exists for this block. If it exists and is necessary (CBlockIndex::GetBlockHeader), it is loaded from disk instead (this is a rare case, though).

Doing this reduces the storage required for blkindex.dat on my system from 400 MiB to 230 MiB. Also loading at start-up should be faster due to this. (Note that the blkindex.dat file is rewritten on first start with the patch, but that the file isn't compressed right away; presumably because BDB keeps the free space. Doing a dump & load of the database with BDB tools produces these file sizes.)

I also removed a check of the PoW when loading blkindex.dat, since this can't be done without also loading the auxpow (defeating the whole purpose of this patch). It should not matter, since the blocks in blkindex.dat have been verified already anyway.

Please test thoroughly. I've tested syncing a few new blocks from an existing blockchain directory, as well as starting initial block download with a fresh one so far. Will keep it running with the patch further, but I've not been able to explicitly trigger the GetBlockHeader calls, reorganisations or anything like this.