Author

Topic: Get hash of oldest stored block (Core pruned mode)? (Read 180 times)

member
Activity: 301
Merit: 74
Thanks.

getblockchaininfo's pruneheight property is indeed it.

cellard, that subtraction assumes each block is exactly 1MB, and that pruning keeps exactly the prune target in raw block data.
staff
Activity: 3458
Merit: 6793
Just writing some code
getblockchaininfo will tell you the height of the oldest stored complete block. You can then look up its hash using getblockhash.
legendary
Activity: 1372
Merit: 1252
With Core in pruned mode, is there a command to get the hash of the oldest stored block?






I don't think so. It would be an interesting command to have. If there isn't, and until then, you can manually check it by subtracting N from current last block height, N being the number that you entered in the "prune=N" setting in your bitcoin.conf

So do:

getblockcount

This will give you the latest block you have. For instance for me right now is 526788, so let's say your prune N value is 550

526788-550=526238

getblockhash 526238

And there you go. If you try to get the hash of a block that is behind N you should get an error, something like "block not available (pruned data)".

A cvar that automates these steps could be added I guess.
member
Activity: 301
Merit: 74
With Core in pruned mode, is there a command to get the hash of the oldest stored block?




Jump to: