5

I'd like to test pruning logic using bitcoind in regtest mode, however, given the nature of regtest, blocks are rather empty (if not fully). Is there any way of easily generating full blocks so the pruning logic can kick in?

I'm interested in solutions involving only bitcoin-cli.

1 Answer 1

7

There is the test-only -fastprune bitcoind option, which results in a much smaller maximum blockfile size (16 kb) and a lower minimum prune height. If that option is used, you could just bitcoin-cli -generate a couple hundred empty blocks and then use the pruneblockchain RPC to prune some blockfiles manually. It's being used in some of the functional tests, for example.

3
  • Is that documented somewhere? I'm interested in what the range values for -fastprune may be, given it looks like it's not simply a flag.
    – sr_gi
    May 5 at 13:39
  • 1
    it is simply a boolean flag (and the option is hidden and not documented well, because it's basically just a hack for devs to be able to tests pruning better, nothing any user should ever do). Probably the best way is to grep for fastprune in the codebase.
    – Lightlike
    May 5 at 14:18
  • So just for completeness, the easiest way of doing so is using both -fastprune and manually pruning with bitcoin-cli pruneblockchain
    – sr_gi
    May 5 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.