chronokings/huntercoin — pull request #75 by domob1812 (2014-08-12 11:35:21+00:00)
Title: Implement prune_gamedb RPC command.

Add a first (trivial) "appetizer" for pruning: With this patch, a new RPC command "prune_gamedb" is implemented. This can be used to remove old entries from game.dat to shrinken it. The exact usage is like this:

`huntercoind prune_gamedb DEPTH`

DEPTH is the number of blocks to keep. At least the current state and one before it will always be kept, though, so it is possible to use 0 as DEPTH.

Pruning of the game state should be possible without any risk. The only consequence is that the game state has to be recalculated (expensive!) when game_getstate is used with an explicit old block number, or a reorganisation is going back beyond the last saved state (unlikely).

Doing `prune_gamedb 5000` brings the size of game.dat down from 200 MiB to less than 1 MiB. So it is not entirely pointless, although this pruning is, admittedly, the one with the least potential savings. But it was also the easiest to implement.