I decided to follow the option of pruning my local copy of the bitcoin blockchain to save some space on my hard drive, but this does actually impact some functionality in terms of being able to explore the full history of the blockchain, and it's difficult to know how far I can explore back in the chain with getblockhash(some_block_height) before I get a Block not available (pruned data) (code -1) error in the debug console.
After a lot of trial and error, I just found out that getblockchaininfo contains a pruneheight key which tells me the height at which blocks stopped being pruned. So, in my case I know that the pruneheight for my local copy of the blockchain is '1413229', so if I try to perform getblockhash for a block height any lower than that number I will get an error.
It might be useful to make students aware of pruneheight in getblockchaininfo at some point? Although, I'm not sure where an appropriate place would be to do that…
I decided to follow the option of pruning my local copy of the bitcoin blockchain to save some space on my hard drive, but this does actually impact some functionality in terms of being able to explore the full history of the blockchain, and it's difficult to know how far I can explore back in the chain with
getblockhash(some_block_height)
before I get aBlock not available (pruned data) (code -1)
error in the debug console.After a lot of trial and error, I just found out that
getblockchaininfo
contains apruneheight
key which tells me the height at which blocks stopped being pruned. So, in my case I know that thepruneheight
for my local copy of the blockchain is '1413229', so if I try to performgetblockhash
for a block height any lower than that number I will get an error.It might be useful to make students aware of
pruneheight
ingetblockchaininfo
at some point? Although, I'm not sure where an appropriate place would be to do that…Hopefully that's helpful feedback in any case!
Page where information on pruning appears: https://classroom.udacity.com/nanodegrees/nd1309/parts/31b86083-85e4-43ae-b154-6905b461f2c1/modules/0af5bc78-b446-4b60-b9cd-8659536cd59f/lessons/8abea3d8-b174-4f57-ad1d-03bc1bf0f68d/concepts/f287c4c0-9d88-4b79-878e-370d05d36c02#
Thanks!