bitcoin/bitcoin — pull request #1405 by TheBlueMatt (2012-05-31 22:26:01+00:00)
Title: Support launching with -prune to prune spent CTxIndex's from CTxDBPrune

I did this to see how much it would actually prune, but, as it pruned just over half of the CTxIndexs in blkindex.dat, I thought I'd pull request it.
It only prunes up to the latest checkpoint as there is no undoing pruning, so chain reorgs cant undo transactions that have CTxIns that were pruned.

I purposely didn't write in pruning during IBD because it could make users stuck if someone builds a malicious block on an old block and feeds it to peers which are in IBD. For related DoS reasons (disk filling using diff-1 blocks in blkNNNN.dat), I would like to see us download block headers between checkpoints during IBD and then get full blocks after verifying the chain between the previous and next header. At that point, pruning during IBD could be safely implemented.